Beispiel #1
0
        public void IntegerValueStorage_Add_AddsTwoIntegers()
        {
            IntegerValueStorage storage1 = new IntegerValueStorage(100);
            IntegerValueStorage storage2 = new IntegerValueStorage(200);

            Assert.Equal(300, storage1.Add(storage2).AsLong);
        }
Beispiel #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);
        }
Beispiel #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);
        }