// 'Function "calculateDefaultFee" returns expected values;'
        public void CorrectCalculateFee()
        {
            const int    defaultAmount = 100;
            const String defaultDenom  = "commercio";
            const int    defaultGas    = 200;
            int          msgsNumber    = 2;

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

            StdFee expectedFee = new StdFee(
                amount: new List <StdCoin>
            {
                new StdCoin(
                    denom: defaultDenom,
                    amount: (defaultAmount * msgsNumber).ToString()
                    )
            },
                gas: (defaultGas * msgsNumber).ToString()
                );

            StdFee fee = GenericUtils.calculateDefaultFee(
                msgsNumber: msgsNumber,
                fee: defaultAmount,
                denom: defaultDenom,
                gas: defaultGas
                );

            Assert.AreEqual(compareLogic.Compare(fee.toJson(), expectedFee.toJson()).AreEqual, true);
        }
Exemplo n.º 2
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);
        }