Skip to content

Commit

Permalink
fix(xUnit1012): address static code analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
skwasjer committed Dec 21, 2023
1 parent e8c0f8d commit dc0a3eb
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
6 changes: 3 additions & 3 deletions test/IbanNet.Tests/IbanParserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ public Integration()
[InlineData("", typeof(IbanFormatException))]
[InlineData("AD12000120359100100", typeof(IbanFormatException))]
[InlineData("Invalid", typeof(IbanFormatException))]
public void Given_invalid_value_when_parsing_it_should_throw(string attemptedIbanValue, Type expectedExceptionType)
public void Given_invalid_value_when_parsing_it_should_throw(string? attemptedIbanValue, Type expectedExceptionType)
{
// Act
Action act = () => _sut.Parse(attemptedIbanValue);
Action act = () => _sut.Parse(attemptedIbanValue!);

// Assert
act.Should()
Expand All @@ -46,7 +46,7 @@ public void Given_invalid_value_when_parsing_it_should_throw(string attemptedIba
[InlineData("")]
[InlineData("AD12000120359100100")]
[InlineData("Invalid")]
public void Given_invalid_value_when_trying_parsing_it_should_not_throw_and_return_false(string attemptedIbanValue)
public void Given_invalid_value_when_trying_parsing_it_should_not_throw_and_return_false(string? attemptedIbanValue)
{
// Act
Func<bool> act = () => _sut.TryParse(attemptedIbanValue, out _);
Expand Down
2 changes: 1 addition & 1 deletion test/IbanNet.Tests/IbanTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ public void Given_an_iban_when_serializing_it_should_return_expected_json(string
[InlineData(null, "null")] // JSON null.
[InlineData(null, "\"\"")] // Empty string
[InlineData(null, "\" \"")] // String with whitespace
public void Given_a_valid_jsonString_when_deserializing_it_should_return_expected_iban(string expectedIban, string json)
public void Given_a_valid_jsonString_when_deserializing_it_should_return_expected_iban(string? expectedIban, string json)
{
// Act
Iban? iban = System.Text.Json.JsonSerializer.Deserialize<Iban>(json);
Expand Down
2 changes: 1 addition & 1 deletion test/IbanNet.Tests/IbanValidatorIntegrationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void When_validating_iban_that_allows_lowercase_it_should_validate()
[Theory]
[InlineData(null)]
[InlineData("")]
public void When_validating_null_or_empty_value_should_not_validate(string iban)
public void When_validating_null_or_empty_value_should_not_validate(string? iban)
{
// Act
ValidationResult actual = _sut.Validate(iban);
Expand Down
2 changes: 1 addition & 1 deletion test/IbanNet.Tests/Internal/InputNormalizationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class InputNormalizationTests
[InlineData("UNCHANGED", "UNCHANGED")]
[InlineData("", "")]
[InlineData(null, null)]
public void Given_string_when_normalizing_it_should_return_expected_value(string input, string expected)
public void Given_string_when_normalizing_it_should_return_expected_value(string? input, string? expected)
{
// Act
string? actual = InputNormalization.NormalizeOrNull(input);
Expand Down
5 changes: 2 additions & 3 deletions test/IbanNet.Tests/Registry/IbanCountryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ public class IbanCountryTests
[InlineData("")]
[InlineData("N")]
[InlineData("NLD")]
public void When_country_code_is_of_invalid_length_should_throw(string twoLetterISORegionName)
public void When_country_code_is_of_invalid_length_should_throw(string? twoLetterISORegionName)
{
// Act
// ReSharper disable once ObjectCreationAsStatement
Func<IbanCountry> act = () => new IbanCountry(twoLetterISORegionName);
Func<IbanCountry> act = () => new IbanCountry(twoLetterISORegionName!);

// Assert
act.Should()
Expand Down

0 comments on commit dc0a3eb

Please sign in to comment.