public override object ConvertFrom(
     ITypeDescriptorContext context,
     CultureInfo culture,
     object value)
 {
     return(UMoney.Parse((string)value));
 }
        public UMoneyFormatterTests()
        {
            _expectedDeserializedValue = UMoney.Parse("42.0");
            _expectedSerializedValue   = new byte[] { 146, 196, 2, 164, 1, 1 };
            _formatterResolver         = new TestFormatterResolver();

            _formatterResolver
            .SetFormatter(new UMoneyFormatter());
        }
Ejemplo n.º 3
0
        public bool Test_hash_code_equation(string a, string b)
        {
            var aParts = a.Split(':');
            var bParts = b.Split(':');

            var aFee = new Fee(new Asset(aParts[0]), UMoney.Parse(aParts[1]));
            var bFee = new Fee(new Asset(bParts[0]), UMoney.Parse(bParts[1]));

            return(aFee.GetHashCode() == bFee.GetHashCode());
        }
Ejemplo n.º 4
0
        public int Test_comparison(string a, string b)
        {
            var aParts = a.Split(':');
            var bParts = b.Split(':');

            var aFee = new Fee(new Asset(aParts[0]), UMoney.Parse(aParts[1]));
            var bFee = new Fee(new Asset(bParts[0]), UMoney.Parse(bParts[1]));

            return(aFee.CompareTo(bFee));
        }
Ejemplo n.º 5
0
        public bool Test_equation(string a, string b)
        {
            var aParts = a.Split(':');
            var bParts = b.Split(':');

            var aFee = new Fee(new Asset(aParts[0]), UMoney.Parse(aParts[1]));
            var bFee = new Fee(new Asset(bParts[0]), UMoney.Parse(bParts[1]));

            return(Equals(aFee, bFee));
        }