switch from FluentAssertions to Shouldly
Some checks failed
.NET Test / test (8.x) (push) Failing after 1m21s
.NET Test / test (9.x) (push) Failing after 1m25s

This commit is contained in:
2025-11-11 17:57:10 +04:00
parent 312219d42f
commit e28fc62b31
13 changed files with 109 additions and 81 deletions

View File

@@ -19,7 +19,7 @@ public class Decode
var resultString = Base64Url.Encode(testBytes);
var resultBytes = Base64Url.Decode(resultString);
resultBytes.Should().BeEquivalentTo(testBytes);
resultBytes.ShouldBeEquivalentTo(testBytes);
}
}
@@ -39,7 +39,7 @@ public class Decode
var resultString = Base64Url.Encode(testLong);
var resultLong = Base64Url.DecodeLong(resultString);
resultLong.Should().Be(testLong);
resultLong.ShouldBe(testLong);
}
}
@@ -57,7 +57,7 @@ public class Decode
public void WhenCalled_ShouldReturnValidLong(string testString, long expected)
{
var result = Base64Url.DecodeLong(testString);
result.Should().Be(expected);
result.ShouldBe(expected);
}
[Theory]
@@ -70,7 +70,7 @@ public class Decode
{
var result = Base64Url.DecodeGuid(testString);
var expected = Guid.Parse(expectedStr);
result.Should().Be(expected);
result.ShouldBe(expected);
}
[Theory]
@@ -85,7 +85,7 @@ public class Decode
public void WhenCalled_ShouldReturnValidBytes(string testString, byte[] expected)
{
var result = Base64Url.Decode(testString);
result.Should().BeEquivalentTo(expected);
result.ShouldBeEquivalentTo(expected);
}
[Theory]
@@ -97,7 +97,7 @@ public class Decode
public void WhenCalledWithInvalidString_ShouldThrowFormatException(string testString)
{
Action action = () => Base64Url.Decode(testString);
action.Should().Throw<FormatException>();
action.ShouldThrow<FormatException>();
}
[Theory]
@@ -109,7 +109,7 @@ public class Decode
public void WhenCalledWithInvalidGuidString_ShouldThrowFormatException(string testString)
{
Action action = () => Base64Url.DecodeGuid(testString);
action.Should().Throw<FormatException>();
action.ShouldThrow<FormatException>();
}
[Theory]
@@ -122,7 +122,7 @@ public class Decode
public void WhenCalledWithInvalidLongString_ShouldThrowFormatException(string testString)
{
Action action = () => Base64Url.DecodeLong(testString);
action.Should().Throw<FormatException>();
action.ShouldThrow<FormatException>();
}
[Theory]
@@ -130,6 +130,6 @@ public class Decode
[InlineData("")]
public void WhenCalledWithNullString_ShouldReturnEmptyArray(string? testString)
{
Base64Url.Decode(testString).Should().BeEmpty();
Base64Url.Decode(testString).ShouldBeEmpty();
}
}

View File

@@ -12,7 +12,7 @@ public class Encode
{
var testGuid = Guid.Parse(testGuidString);
var result = Base64Url.Encode(testGuid);
result.Should().Be(expected);
result.ShouldBe(expected);
}
[Theory]
@@ -29,7 +29,7 @@ public class Encode
public void WhenCalledWithLong_ShouldReturnValidString(string expected, long testLong)
{
var result = Base64Url.Encode(testLong);
result.Should().Be(expected);
result.ShouldBe(expected);
}
[Theory]
@@ -44,7 +44,7 @@ public class Encode
public void WhenCalled_ShouldReturnValidString(string expected, byte[] testBytes)
{
var result = Base64Url.Encode(testBytes);
result.Should().Be(expected);
result.ShouldBe(expected);
}
[Theory]
@@ -53,7 +53,7 @@ public class Encode
public void WhenCalledWithEmptyByteArray_ShouldReturnEmptyString(byte[]? testArray)
{
var actualBase32 = Base64Url.Encode(testArray);
actualBase32.Should().Be(string.Empty);
actualBase32.ShouldBe(string.Empty);
}
[Theory]
@@ -65,7 +65,7 @@ public class Encode
var charsWritten = Base64Url.Encode(testArray, output);
charsWritten.Should().Be(0);
output.Should().Equal(['1', '2', '3', '4']);
charsWritten.ShouldBe(0);
output.ShouldBe((char[])['1', '2', '3', '4']);
}
}