public void Size2_TryParse_FailsForInvalidStrings() { var result = default(Size2); var succeeded = Size2.TryParse("foo", out result); TheResultingValue(succeeded).ShouldBe(false); }
public void Size2_TryParse_SucceedsForValidStrings() { var str = "123 456"; var result = default(Size2); if (!Size2.TryParse(str, out result)) { throw new InvalidOperationException("Unable to parse string to Size2."); } TheResultingValue(result) .ShouldBe(123, 456); }