public void GetRandomInt64Test() { var actual = RandomValueEx.GetRandomInt64(10, 20); Assert.True(actual >= 10, "To small"); Assert.True(actual < 20, "To big"); }
public void SafeToInt64InvalidValueDefaultTest() { var expected = RandomValueEx.GetRandomInt64(); var actual = "InvalidValue".SafeToInt64(expected); actual .Should() .Be(expected); }
public void SafeToInt64OverloadInvalidValueWithDefaultTest() { var expected = RandomValueEx.GetRandomInt64(); var actual = "InvalidValue".SafeToInt64(NumberStyles.Any, CultureInfo.InvariantCulture, expected); actual .Should() .Be(expected); }
public void TryParsInt64OverloadInvalidNumberFormatTest() { var expected = RandomValueEx.GetRandomInt64(); Action test = () => expected.ToString(CultureInfo.InvariantCulture) // ReSharper disable once UnusedVariable .TryParsInt64(NumberStyles.AllowDecimalPoint | NumberStyles.HexNumber, CultureInfo.InvariantCulture, out Int64 result); test.ShouldThrow <ArgumentException>(); }
public void SafeToInt64WithDefaultTest() { var expected = RandomValueEx.GetRandomInt64(); var actual = expected.ToString(CultureInfo.InvariantCulture) .SafeToInt64(RandomValueEx.GetRandomInt64()); actual .Should() .Be(expected); }
public void SafeToInt64OverloadWitDefaultTest() { var expected = RandomValueEx.GetRandomInt64(); var actual = expected.ToString(CultureInfo.InvariantCulture) .SafeToInt64(NumberStyles.Any, CultureInfo.InvariantCulture, RandomValueEx.GetRandomInt64()); actual .Should() .Be(expected); }
public void ToInt64Test() { var value = RandomValueEx.GetRandomInt64(); var actual = value.ToString() .ToInt64(); actual .Should() .Be(value); }
public void TryParsInt64OverloadFormatProviderNullTest() { var expected = RandomValueEx.GetRandomInt64(); CultureInfo culture = null; // ReSharper disable once AssignNullToNotNullAttribute Action test = () => expected.ToString(CultureInfo.InvariantCulture) // ReSharper disable once UnusedVariable .TryParsInt64(NumberStyles.Any, culture, out Int64 result); test.ShouldThrow <ArgumentNullException>(); }
public void SafeToInt64NullDefaultTest() { String value = null; var expected = RandomValueEx.GetRandomInt64(); // ReSharper disable once ExpressionIsAlwaysNull var actual = value.SafeToInt64(expected); actual .Should() .Be(expected); }
public void SafeToInt64OverloadNullWithDefaultTest() { String value = null; var expected = RandomValueEx.GetRandomInt64(); // ReSharper disable once ExpressionIsAlwaysNull var actual = value.SafeToInt64(NumberStyles.Any, CultureInfo.InvariantCulture, expected); actual .Should() .Be(expected); }
public void ToInt64OverloadTest() { var culture = new CultureInfo("de-CH"); var value = RandomValueEx.GetRandomInt64(); var actual = value.ToString(culture) .ToInt64(culture); actual .Should() .Be(value); }
public void TryParsInt64Test() { var expected = RandomValueEx.GetRandomInt64(); var actual = expected.ToString(CultureInfo.CurrentCulture) .TryParsInt64(out Int64 result); result .Should() .Be(expected); actual .Should() .BeTrue(); }
public void TryParsInt64OverloadTest() { var culture = new CultureInfo("de-CH"); var expected = RandomValueEx.GetRandomInt64(); var actual = expected.ToString(culture) .TryParsInt64(NumberStyles.Any, culture, out Int64 result); result .Should() .Be(expected); actual .Should() .BeTrue(); }
public void GetRandomInt64TestArgumentOutOfRangeException() { Action test = () => RandomValueEx.GetRandomInt64(20, 10); test.ShouldThrow <ArgumentOutOfRangeException>(); }
public void GetRandomInt64TestArgumentOutOfRangeException() { Action test = () => RandomValueEx.GetRandomInt64(20, 10); Assert.Throws <ArgumentOutOfRangeException>(test); }