コード例 #1
0
        public void TestJson()
        {
            StdCoin origCoin, recoveredCoin;
            Dictionary <String, Object> origJson, recJson;

            //This is the comparison class
            CompareLogic compareLogic = new CompareLogic();

            origCoin = new StdCoin(denom: "PizzaDiFango", amount: "100");

            origJson      = origCoin.toJson();
            recoveredCoin = new StdCoin(origJson);
            recJson       = recoveredCoin.toJson();

            // Verify if all the values in the Dictionary are the same
            foreach (var item in origJson)
            {
                Object outValue;
                String netString, recString;

                if (recJson.TryGetValue(item.Key, out outValue))
                {
                    netString = item.Value as String;
                    recString = outValue as String;
                    Assert.AreEqual(netString, recString);
                }
            }
            // Check it - we use compareNet objects here
            ComparisonResult result = compareLogic.Compare(origCoin, recoveredCoin);

            Assert.AreEqual(result.AreEqual, true);
        }
コード例 #2
0
 public ExchangeTradePosition(JObject json)
 {
     this.createdAt    = (DateTime)json["created_at"];
     this.id           = (String)json["id"];
     this.owner        = (String)json["owner"];
     this.exchangeRate = (String)json["exchange_rate"];
     this.collateral   = (String)json["collateral"];
     this.credits      = new StdCoin(json["credits"] as JObject);
 }
コード例 #3
0
 public ExchangeTradePosition(DateTime createdAt, string id, string owner, string exchange_rate, string collateral, StdCoin credits)
 {
     this.createdAt    = createdAt;
     this.id           = id;
     this.owner        = owner;
     this.exchangeRate = exchange_rate;
     this.collateral   = collateral;
     this.credits      = credits;
 }
コード例 #4
0
        public void TestJson()
        {
            StdFee         origFee;
            StdCoin        coin1, coin2;
            List <StdCoin> coinList, recoveredList;
            Dictionary <String, Object> origJson;


            coin1    = new StdCoin(denom: "PizzaDiFango", amount: "100");
            coin2    = new StdCoin(denom: "LifeUniverse", amount: "42");
            coinList = new List <StdCoin>();
            coinList.Add(coin1);
            coinList.Add(coin2);

            origFee = new StdFee(amount: coinList, gas: "0.1");

            origJson = origFee.toJson();

            recoveredList = origFee.amount;

            // Verify if the object is correct
            Assert.AreEqual(coinList, recoveredList);
        }