Skip to content

Commit 80d62e8

Browse files
author
AndrewMorgan1
committed
Added positive TryParseHumanBytes to HumanBytesExtensionsTests
1 parent a432f2b commit 80d62e8

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

tests/ByteFlow.Tests/HumanBytesExtensionsTests.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,17 @@ public void ToBytes_Null_ShouldThrow()
5959
Assert.Throws<ArgumentNullException>(() => input.ToBytes());
6060
}
6161

62+
[Fact]
63+
public void TryParseHumanBytes_ValidInput_ShouldReturnTrue()
64+
{
65+
// Act
66+
bool success = "1 MB".TryParseHumanBytes(out long result);
67+
68+
// Assert
69+
Assert.True(success);
70+
Assert.Equal(1048576, result);
71+
}
72+
6273
[Fact]
6374
public void TryParseHumanBytes_ShouldReturnFalseOnInvalidInput()
6475
{

0 commit comments

Comments
 (0)