Esempio n. 1
0
        public MarketTests()
        {
            var defaultPrices = new Dictionary <Commodity, decimal>()
            {
                { grain, 4 },
                { meat, 5 }
            };

            market = new Market("Market1", new SimpleSalesHistory(defaultPrices));

            seller.commodityStorage.Deposit(grain, 15);

            var grainSellOffer1 = new StableSellOffer(
                ammount: 10,
                commodity: grain,
                price: 2,
                seller: seller
                );

            var grainSellOffer2 = new StableSellOffer(
                ammount: 5,
                commodity: grain,
                price: 1,
                seller: seller
                );

            market.AddSellOffer(grainSellOffer1);
            market.AddSellOffer(grainSellOffer2);
        }
Esempio n. 2
0
        public void SellerShouldHaveCommodityTakenAfterPostingSellOffer()
        {
            seller.commodityStorage.Deposit(meat, 100);

            var meatSellOffer = new StableSellOffer(
                ammount: 60,
                commodity: meat,
                price: 10,
                seller: seller
                );

            Assert.AreEqual(100, seller.commodityStorage[meat]);
            market.AddSellOffer(meatSellOffer);
            Assert.AreEqual(40, seller.commodityStorage[meat]);
        }