File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed
Algorithms.Tests/Strings/Similarity
Algorithms/Strings/Similarity Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -75,19 +75,19 @@ public void Calculate_MultipleOperations_ReturnsCorrectDistance()
75
75
public void Calculate_FirstStringNull_ThrowsArgumentNullException ( )
76
76
{
77
77
string ? nullString = null ;
78
- #pragma warning disable CS8604 // Possible null reference argument.
78
+ #nullable disable
79
79
Action act = ( ) => OptimalStringAlignment . Calculate ( nullString , "example" ) ;
80
- #pragma warning restore CS8604 // Possible null reference argument.
80
+ #nullable restore
81
81
act . Should ( ) . Throw < ArgumentNullException > ( ) . WithMessage ( "*firstString*" ) ;
82
82
}
83
83
84
84
[ Test ]
85
85
public void Calculate_SecondStringNull_ThrowsArgumentNullException ( )
86
86
{
87
87
string ? nullString = null ;
88
- #pragma warning disable CS8604 // Possible null reference argument.
88
+ #nullable disable
89
89
Action act = ( ) => OptimalStringAlignment . Calculate ( "example" , nullString ) ;
90
- #pragma warning restore CS8604 // Possible null reference argument.
90
+ #nullable restore
91
91
act . Should ( ) . Throw < ArgumentNullException > ( ) . WithMessage ( "*secondString*" ) ;
92
92
}
93
93
}
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ namespace Algorithms.Strings.Similarity
45
45
/// This algorithm has a time complexity of O(n * m), where n and m are the lengths of the two input strings.
46
46
/// It is efficient for moderate-sized strings but may become computationally expensive for very long strings.
47
47
/// </remarks>
48
- public class OptimalStringAlignment
48
+ public static class OptimalStringAlignment
49
49
{
50
50
/// <summary>
51
51
/// Calculates the Optimal String Alignment distance between two strings.
@@ -56,8 +56,8 @@ public class OptimalStringAlignment
56
56
/// <exception cref="ArgumentNullException">Thrown when either of the input strings is null.</exception>
57
57
public static double Calculate ( string firstString , string secondString )
58
58
{
59
- ArgumentNullException . ThrowIfNull ( firstString , nameof ( firstString ) ) ;
60
- ArgumentNullException . ThrowIfNull ( secondString , nameof ( secondString ) ) ;
59
+ ArgumentNullException . ThrowIfNull ( nameof ( firstString ) ) ;
60
+ ArgumentNullException . ThrowIfNull ( nameof ( secondString ) ) ;
61
61
62
62
if ( firstString == secondString )
63
63
{
You can’t perform that action at this time.
0 commit comments