コード例 #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 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})"));
        }