Пример #1
0
        public void RecordSurvivorDroppedEquipmentEvent()
        {
            var game     = new Game();
            var survivor = new Survivor("John");

            game.AddSurvivorToGame(survivor);;

            var baseballBat  = EquipmentFactory.GetEquipment(EquipmentType.BaseballBat);
            var katana       = EquipmentFactory.GetEquipment(EquipmentType.Katana);
            var kar98        = EquipmentFactory.GetEquipment(EquipmentType.Kar98);
            var bottledWater = EquipmentFactory.GetEquipment(EquipmentType.BottledWater);
            var knife        = EquipmentFactory.GetEquipment(EquipmentType.Knife);

            survivor.PickUpItem(baseballBat);
            survivor.PickUpItem(katana);
            survivor.PickUpItem(kar98);
            survivor.PickUpItem(bottledWater);
            survivor.PickUpItem(knife);

            var result = survivor.ReceiveWound(1);

            var lastEvent = game.GameHistory.LastOrDefault();

            Assert.IsNotNull(lastEvent);
            Assert.IsTrue(lastEvent.EventDetail.StartsWith($"{survivor.Name} drops a piece of equipment"));
        }
Пример #2
0
        public void RecordSurvivorDroppedEquipmentEvent()
        {
            var game     = new Game();
            var survivor = new Survivor("Bill");

            game.AddSurvivorToGame(survivor);;

            var baseballBat  = EquipmentFactory.GetEquipment(EquipmentType.BaseballBat);
            var katana       = EquipmentFactory.GetEquipment(EquipmentType.Katana);
            var pistol       = EquipmentFactory.GetEquipment(EquipmentType.Pistol);
            var bottledWater = EquipmentFactory.GetEquipment(EquipmentType.BottledWater);
            var fryingPan    = EquipmentFactory.GetEquipment(EquipmentType.FireAxe);

            survivor.PickUpItem(baseballBat);
            survivor.PickUpItem(katana);
            survivor.PickUpItem(pistol);
            survivor.PickUpItem(bottledWater);
            survivor.PickUpItem(fryingPan);

            var result = survivor.SustainInjury(1);

            var lastEvent = game.GameHistory.LastOrDefault();

            Assert.IsNotNull(lastEvent);
            Assert.IsTrue(lastEvent.EventDetail.StartsWith($"{survivor.Name} drops a piece of equipment"));
        }
Пример #3
0
        public void OneItemPickedUpGoesInHand()
        {
            var survivor = new Survivor("John");
            var knife    = EquipmentFactory.GetEquipment(EquipmentType.Knife);

            var isPickedUp = survivor.PickUpItem(knife);

            Assert.IsTrue(survivor.Inventory.Contains(knife));
            Assert.IsTrue(knife.InHand);
        }
Пример #4
0
        public void FirstItemPickedUpIsInHand_GivenNoItemsInInventory()
        {
            var survivor    = new Survivor("Bill");
            var baseballBat = EquipmentFactory.GetEquipment(EquipmentType.BaseballBat);

            var isPickedUp = survivor.PickUpItem(baseballBat);

            Assert.IsTrue(survivor.Inventory.Contains(baseballBat));
            Assert.IsTrue(baseballBat.InHand);
        }
Пример #5
0
        public void EquipmentIsAddedToInventory_GivenSufficientCapacity()
        {
            var survivor    = new Survivor("Bill");
            var baseballBat = EquipmentFactory.GetEquipment(EquipmentType.BaseballBat);

            var isPickedUp = survivor.PickUpItem(baseballBat);

            Assert.IsTrue(survivor.Inventory.Contains(baseballBat));
            Assert.IsTrue(isPickedUp);
        }
Пример #6
0
        public void AddOneEquipmentToInventory()
        {
            var survivor = new Survivor("John");
            var knife    = EquipmentFactory.GetEquipment(EquipmentType.Knife);

            var isPickedUp = survivor.PickUpItem(knife);

            Assert.IsTrue(survivor.Inventory.Contains(knife));
            Assert.IsTrue(isPickedUp);
        }
Пример #7
0
        public void RecordEquipmentPickedUpBySurvivor()
        {
            var game     = new Game();
            var survivor = new Survivor("John");

            game.AddSurvivorToGame(survivor);
            var equipment = EquipmentFactory.GetEquipment(EquipmentType.BaseballBat);

            survivor.PickUpItem(equipment);
            var lastEvent = game.GameHistory.LastOrDefault();

            Assert.IsNotNull(lastEvent);
            Assert.IsTrue(lastEvent.EventDetail.StartsWith($"{survivor.Name} picks up a piece of equipment ({equipment.Name})"));
        }
Пример #8
0
        public void TwoItemsPickedUpGoesInHand()
        {
            var survivor = new Survivor("John");
            var Knife    = EquipmentFactory.GetEquipment(EquipmentType.Knife);
            var katana   = EquipmentFactory.GetEquipment(EquipmentType.Katana);

            survivor.PickUpItem(Knife);
            survivor.PickUpItem(katana);

            Assert.IsTrue(survivor.Inventory.Contains(Knife));
            Assert.IsTrue(survivor.Inventory.Contains(katana));
            Assert.IsTrue(Knife.InHand);
            Assert.IsTrue(katana.InHand);
        }
Пример #9
0
        public void SecondItemPickedUpIsInHand_GivenNoItemsInInventory()
        {
            var survivor    = new Survivor("Bill");
            var baseballBat = EquipmentFactory.GetEquipment(EquipmentType.BaseballBat);
            var katana      = EquipmentFactory.GetEquipment(EquipmentType.Katana);

            survivor.PickUpItem(baseballBat);
            survivor.PickUpItem(katana);

            Assert.IsTrue(survivor.Inventory.Contains(baseballBat));
            Assert.IsTrue(survivor.Inventory.Contains(katana));
            Assert.IsTrue(baseballBat.InHand);
            Assert.IsTrue(katana.InHand);
        }
Пример #10
0
        public void NoItemDroppedWhenWounded_GivenSufficentCarryingCapacity()
        {
            var survivor = new Survivor("Bill");

            var baseballBat = EquipmentFactory.GetEquipment(EquipmentType.BaseballBat);
            var katana      = EquipmentFactory.GetEquipment(EquipmentType.Katana);
            var pistol      = EquipmentFactory.GetEquipment(EquipmentType.Pistol);

            survivor.PickUpItem(baseballBat);
            survivor.PickUpItem(katana);
            survivor.PickUpItem(pistol);

            var result = survivor.SustainInjury(1);

            Assert.IsFalse(result.isEquipmentDropped);
        }
Пример #11
0
        public void NotDropItemWhenWoundedAndSufficientEquipmentCapacity()
        {
            var survivor = new Survivor("John");

            var baseballBat = EquipmentFactory.GetEquipment(EquipmentType.BaseballBat);
            var katana      = EquipmentFactory.GetEquipment(EquipmentType.Katana);
            var knife       = EquipmentFactory.GetEquipment(EquipmentType.Knife);

            survivor.PickUpItem(baseballBat);
            survivor.PickUpItem(katana);
            survivor.PickUpItem(knife);

            var result = survivor.ReceiveWound(1);

            Assert.IsFalse(result.isEquipmentDropped);
        }
Пример #12
0
        public void ThirdItemGoesToReserve()
        {
            var survivor     = new Survivor("John");
            var Knife        = EquipmentFactory.GetEquipment(EquipmentType.Knife);
            var katana       = EquipmentFactory.GetEquipment(EquipmentType.Katana);
            var bottledWater = EquipmentFactory.GetEquipment(EquipmentType.BottledWater);

            survivor.PickUpItem(Knife);
            survivor.PickUpItem(katana);
            survivor.PickUpItem(bottledWater);

            Assert.IsTrue(survivor.Inventory.Contains(Knife));
            Assert.IsTrue(survivor.Inventory.Contains(katana));
            Assert.IsTrue(survivor.Inventory.Contains(bottledWater));
            Assert.IsTrue(Knife.InHand);
            Assert.IsTrue(katana.InHand);
            Assert.IsFalse(bottledWater.InHand);
        }
Пример #13
0
        public void ThirdItemPickedUpIsInReserve_GivenNoItemsInInventory()
        {
            var survivor     = new Survivor("Bill");
            var baseballBat  = EquipmentFactory.GetEquipment(EquipmentType.BaseballBat);
            var katana       = EquipmentFactory.GetEquipment(EquipmentType.Katana);
            var bottledWater = EquipmentFactory.GetEquipment(EquipmentType.BottledWater);

            survivor.PickUpItem(baseballBat);
            survivor.PickUpItem(katana);
            survivor.PickUpItem(bottledWater);

            Assert.IsTrue(survivor.Inventory.Contains(baseballBat));
            Assert.IsTrue(survivor.Inventory.Contains(katana));
            Assert.IsTrue(survivor.Inventory.Contains(bottledWater));
            Assert.IsTrue(baseballBat.InHand);
            Assert.IsTrue(katana.InHand);
            Assert.IsFalse(bottledWater.InHand);
        }
Пример #14
0
        public void EquipmentNotAddedWhenFullEquipmentCapacity()
        {
            var survivor     = new Survivor("John");
            var baseballBat  = EquipmentFactory.GetEquipment(EquipmentType.BaseballBat);
            var katana       = EquipmentFactory.GetEquipment(EquipmentType.Katana);
            var sunglasses   = EquipmentFactory.GetEquipment(EquipmentType.Sunglasses);
            var bottledWater = EquipmentFactory.GetEquipment(EquipmentType.BottledWater);
            var kar98        = EquipmentFactory.GetEquipment(EquipmentType.Kar98);
            var knife        = EquipmentFactory.GetEquipment(EquipmentType.Knife);

            survivor.PickUpItem(katana);
            survivor.PickUpItem(sunglasses);
            survivor.PickUpItem(bottledWater);
            survivor.PickUpItem(baseballBat);
            survivor.PickUpItem(kar98);

            var isPickedUp = survivor.PickUpItem(knife);

            Assert.IsFalse(survivor.Inventory.Contains(knife));
            Assert.IsFalse(isPickedUp);
        }
Пример #15
0
        public void EquipmentIsNotAddedToInventory_GivenNoCapacity()
        {
            var survivor     = new Survivor("Bill");
            var baseballBat  = EquipmentFactory.GetEquipment(EquipmentType.BaseballBat);
            var katana       = EquipmentFactory.GetEquipment(EquipmentType.Katana);
            var pistol       = EquipmentFactory.GetEquipment(EquipmentType.Pistol);
            var bottledWater = EquipmentFactory.GetEquipment(EquipmentType.BottledWater);
            var fryingPan    = EquipmentFactory.GetEquipment(EquipmentType.FireAxe);
            var molotov      = EquipmentFactory.GetEquipment(EquipmentType.CrowBar);

            survivor.PickUpItem(katana);
            survivor.PickUpItem(pistol);
            survivor.PickUpItem(bottledWater);
            survivor.PickUpItem(fryingPan);
            survivor.PickUpItem(molotov);

            var isPickedUp = survivor.PickUpItem(baseballBat);

            Assert.IsFalse(survivor.Inventory.Contains(baseballBat));
            Assert.IsFalse(isPickedUp);
        }
Пример #16
0
        public void DropAnItemWhenWounded_GivenFiveItemsCarried()
        {
            var survivor = new Survivor("Bill");

            var baseballBat  = EquipmentFactory.GetEquipment(EquipmentType.BaseballBat);
            var katana       = EquipmentFactory.GetEquipment(EquipmentType.Katana);
            var pistol       = EquipmentFactory.GetEquipment(EquipmentType.Pistol);
            var bottledWater = EquipmentFactory.GetEquipment(EquipmentType.BottledWater);
            var fryingPan    = EquipmentFactory.GetEquipment(EquipmentType.FireAxe);

            survivor.PickUpItem(baseballBat);
            survivor.PickUpItem(katana);
            survivor.PickUpItem(pistol);
            survivor.PickUpItem(bottledWater);
            survivor.PickUpItem(fryingPan);

            var result = survivor.SustainInjury(1);

            Assert.IsTrue(result.isEquipmentDropped);
            Assert.IsNotNull(result.droppedEquipment);
            Assert.AreEqual(4, survivor.CarryingCapacity);
            Assert.IsFalse(result.droppedEquipment.InHand);
        }
Пример #17
0
        public void DropItemWhenWoundedAndFullEquipmentCapacity()
        {
            var survivor = new Survivor("John");

            var baseballBat  = EquipmentFactory.GetEquipment(EquipmentType.BaseballBat);
            var katana       = EquipmentFactory.GetEquipment(EquipmentType.Katana);
            var sunglasses   = EquipmentFactory.GetEquipment(EquipmentType.Sunglasses);
            var bottledWater = EquipmentFactory.GetEquipment(EquipmentType.BottledWater);
            var knife        = EquipmentFactory.GetEquipment(EquipmentType.Knife);

            survivor.PickUpItem(baseballBat);
            survivor.PickUpItem(katana);
            survivor.PickUpItem(sunglasses);
            survivor.PickUpItem(bottledWater);
            survivor.PickUpItem(knife);

            var result = survivor.ReceiveWound(1);

            Assert.IsTrue(result.isEquipmentDropped);
            Assert.IsNotNull(result.droppedEquipment);
            Assert.AreEqual(4, survivor.CarryingCapacity);
            Assert.IsFalse(result.droppedEquipment.InHand);
        }