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}");
     }
 }
Exemple #2
0
        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}");
            }
        }
Exemple #3
0
 public void InvalidAmountValueTest()
 {
     IouValue.FromString("silly");
 }
Exemple #4
0
 private static void AssertExponent(string valueString, int expectedExponent)
 {
     Assert.AreEqual(IouValue.FromString(valueString).Exponent, expectedExponent);
 }
Exemple #5
0
 public void PrecisionTest()
 {
     IouValue.FromString("1234" + "1234" + "1234" + "1234" + 1);
 }