Пример #1
0
        private void CheckForTrade(object sender, EventArgs e)
        {
            var list = _reserve.GetProvideProducts();

            list.ForEach(i => _trader.SetProvide(i));

            list = _reserve.GetConsumeProducts();
            list.ForEach(i => _trader.SetConsume(i));
        }
Пример #2
0
        public void ConsumeProduct_AddsProvide()
        {
            const int amount = 100;

            _reserve.SetAmount(ProductId, amount);

            var status = _reserve.GetProductStatus(ProductId);
            var before = _reserve.GetConsumeProducts().FirstOrDefault(i => i.ProductId == ProductId);

            _reserve.SetConsume(ProductId, true);

            var after = _reserve.GetConsumeProducts().FirstOrDefault(i => i.ProductId == ProductId);

            Assert.IsNotNull(status);
            Assert.IsTrue(status.ShouldConsume);
            Assert.IsFalse(status.ShouldProvide);

            Assert.IsNull(before);
            Assert.IsNotNull(after);
            Assert.AreEqual(amount, after.Amount);
        }