Esempio n. 1
0
        public void IntegerValueStorage_Add_AddsTwoIntegers()
        {
            IntegerValueStorage storage1 = new IntegerValueStorage(100);
            IntegerValueStorage storage2 = new IntegerValueStorage(200);

            Assert.Equal(300, storage1.Add(storage2).AsLong);
        }
Esempio n. 2
0
        public void IntegerValueStorage_Add_AddsAmountWithoutCommodityAndChangesToAmount()
        {
            IntegerValueStorage storage1 = new IntegerValueStorage(100);
            AmountValueStorage  storage2 = new AmountValueStorage(new Amount(200));

            IValueStorage result = storage1.Add(storage2);

            Assert.Equal(300, result.AsLong);
            Assert.Equal(ValueTypeEnum.Amount, result.Type);
        }
Esempio n. 3
0
        public void IntegerValueStorage_Add_AddsAmountWithCommodityAndChangesToBalance()
        {
            string    commodityName = "test-commodity";
            Commodity commodity     = CommodityPool.Current.Find(commodityName) ?? CommodityPool.Current.Create(commodityName);

            IntegerValueStorage storage1 = new IntegerValueStorage(100);
            AmountValueStorage  storage2 = new AmountValueStorage(new Amount(200, commodity));

            IValueStorage result = storage1.Add(storage2);

            Assert.Equal(ValueTypeEnum.Balance, result.Type);
        }