public void Size2F_TryParse_FailsForInvalidStrings() { var result = default(Size2F); var succeeded = Size2F.TryParse("foo", out result); TheResultingValue(succeeded) .ShouldBe(false); }
public void Size2F_TryParse_SucceedsForValidStrings() { var str = "123.45 456.78"; var result = default(Size2F); if (!Size2F.TryParse(str, out result)) { throw new InvalidOperationException("Unable to parse string to Size2F."); } TheResultingValue(result) .ShouldBe(123.45f, 456.78f); }