mirror of https://github.com/oliverbooth/X10D
test: 100% coverage for TimeSpanParser.TryParse
This commit is contained in:
parent
628ead1ebb
commit
f30c052673
|
@ -22,6 +22,38 @@ public class TimeSpanParserTests
|
||||||
Assert.AreEqual(default, timeSpan);
|
Assert.AreEqual(default, timeSpan);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void TryParse_ShouldReturnFalse_GivenEmptySpan()
|
||||||
|
{
|
||||||
|
bool result = TimeSpanParser.TryParse(ReadOnlySpan<char>.Empty, out TimeSpan timeSpan);
|
||||||
|
Assert.IsFalse(result);
|
||||||
|
Assert.AreEqual(default, timeSpan);
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void TryParse_ShouldReturnFalse_GivenWhiteSpaceSpan()
|
||||||
|
{
|
||||||
|
bool result = TimeSpanParser.TryParse(" ".AsSpan(), out TimeSpan timeSpan);
|
||||||
|
Assert.IsFalse(result);
|
||||||
|
Assert.AreEqual(default, timeSpan);
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void TryParse_ShouldReturnFalse_GivenEmptyString()
|
||||||
|
{
|
||||||
|
bool result = TimeSpanParser.TryParse(string.Empty, out TimeSpan timeSpan);
|
||||||
|
Assert.IsFalse(result);
|
||||||
|
Assert.AreEqual(default, timeSpan);
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void TryParse_ShouldReturnFalse_GivenWhiteSpaceString()
|
||||||
|
{
|
||||||
|
bool result = TimeSpanParser.TryParse(" ", out TimeSpan timeSpan);
|
||||||
|
Assert.IsFalse(result);
|
||||||
|
Assert.AreEqual(default, timeSpan);
|
||||||
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void TryParse_ShouldReturnFalse_GivenNull()
|
public void TryParse_ShouldReturnFalse_GivenNull()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue