예제 #1
0
        public void DonotBuyThingsYouCannotAfford()
        {
            var clothes  = new Clothes("Outfit", 2000, 5);
            var purchase = new PurchaseClothing(EntityGateway <Clothes> .LoadWithSingleItem(clothes));
            var bob      = CharacterTestTemplates.AverageBob();

            bob.Inventory.CoinPurse.AddGold(1);

            purchase.ExecuteStep(bob);
            Assert.Null(bob.Inventory.Find(clothes));
        }
예제 #2
0
        public void SelectsClothingFromOptionsInStrategy()
        {
            var clothes = new List <Clothes>()
            {
                new Clothes("Outfit", 2000, 5),
                new Clothes("Ignore", 200, 5)
            };
            var purchase = new PurchaseClothing(EntityGateway <Clothes> .LoadFromList(clothes));
            var bob      = CharacterTestTemplates.AverageBob();

            bob.Inventory.CoinPurse.AddGold(200);
            var strategy = bob.Strategy;

            strategy.AddCustomValue("clothes", "Outfit", 1);

            purchase.ExecuteStep(bob);
            Assert.NotNull(bob.Inventory.Find(clothes[0]));
        }