public void ToDecimal_Overflow(LossOfPrecisionHandling handling, bool negate) { string text = "79228162514264337593543950336"; // decimal.MaxValue + 1 BigQueryNumeric numeric = BigQueryNumeric.Parse(text); if (negate) { numeric = -numeric; } Assert.Throws <OverflowException>(() => numeric.ToDecimal(handling)); }
public void ToDecimal_Precise( [CombinatorialValues( "79228162514264337593543950335", // decimal.MaxValue "0.000000001", // Epsilon for numeric "12345678901234567890.123456789" // Maximum significant digits with 9dps )] string text, LossOfPrecisionHandling handling, bool negate) { if (negate) { text = "-" + text; } BigQueryNumeric numeric = BigQueryNumeric.Parse(text); decimal expected = decimal.Parse(text, CultureInfo.InvariantCulture); decimal actual = numeric.ToDecimal(handling); Assert.Equal(expected, actual); }