private static void AssertAmountEqual(JToken expected, JToken actual) { if (expected.Type == JTokenType.String) { Assert.AreEqual(expected.ToString(), actual.ToString()); } if (!JToken.DeepEquals(expected, actual)) { Assert.AreEqual(IouValue.FromString(expected["value"].ToString()).ToString(), IouValue.FromString(expected["value"].ToString()).ToString(), $"expected: {expected}\n" + $"actual: {actual}"); } }
public void AssertValue(string value, string mantissa, int exponent, bool isNegative, int?precision = null) { Normalize(ref mantissa); Normalize(ref value); var val = IouValue.FromString(value); Assert.AreEqual(mantissa, val.Mantissa.ToString(), $"mantissa for {value}"); Assert.AreEqual(exponent, val.Exponent, $"exponent for {value}"); Assert.AreEqual(isNegative, val.IsNegative, $"isNegative for {value}"); if (precision != null) { Assert.AreEqual(precision, val.Precision, $"precision for {value}"); } }
public void InvalidAmountValueTest() { IouValue.FromString("silly"); }
private static void AssertExponent(string valueString, int expectedExponent) { Assert.AreEqual(IouValue.FromString(valueString).Exponent, expectedExponent); }
public void PrecisionTest() { IouValue.FromString("1234" + "1234" + "1234" + "1234" + 1); }