Пример #1
0
        public void IntegerValueStorage_Add_AddsTwoIntegers()
        {
            IntegerValueStorage storage1 = new IntegerValueStorage(100);
            IntegerValueStorage storage2 = new IntegerValueStorage(200);

            Assert.Equal(300, storage1.Add(storage2).AsLong);
        }
Пример #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);
        }
Пример #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);
        }
Пример #4
0
        public void DateTimeValueStorage_Add_SupportsIntegerAndAmount()
        {
            DateTime             date     = new DateTime(2015, 10, 10);
            DateTimeValueStorage storage1 = new DateTimeValueStorage(date);
            IntegerValueStorage  storage2 = new IntegerValueStorage(1000);

            Assert.Equal(date.AddSeconds(1000).Ticks, storage1.Add(storage2).AsLong);

            storage1 = new DateTimeValueStorage(date);
            AmountValueStorage storage3 = new AmountValueStorage(new Amount(2000));

            Assert.Equal(date.AddSeconds(2000).Ticks, storage1.Add(storage3).AsLong);
        }