public void NonnumericStringReturnsNull() { const string NonnumericString = "XYZ"; var result = NonnumericString.ConvertToNullable().Int32.ParseInvariant(); result.HasValue.Should().BeFalse(); }
public void NonnumericStringReturnsDefault() { const string NonnumericString = "XYZ"; const int DefaultValue = 5; var result = NonnumericString.ConvertWithDefaultTo().Int32.ParseInvariant(DefaultValue); result.Should().Be(DefaultValue); }
public void NonnumericStringThrows() { const string NonnumericString = "XYZ"; Assert.Throws <FormatException>(() => NonnumericString.ConvertTo().Int32.ParseInvariant()); }