예제 #1
0
        public void AddCreature_nameAndType_ReturnCreatureAdded()
        {
            room.Add(new Forest("forest"));
            room.AddCreature("Demiguise", "Vabjorn");
            bool creatureAdded = room.GetRoom("forest").CreatureIsHere("Vabjorn");

            Assert.IsTrue(creatureAdded);
        }
예제 #2
0
        public override void AddCreature(string type, string name)
        {
            Place creatureRoom = null;

            creatureRoom = InnerPlaces.Find(a => a.GetCreatureRoom(type) == true);
            if (creatureRoom == null)
            {
                foreach (Place room in InnerPlaces.Where(a => a.IsComposite() == true))
                {
                    room.AddCreature(type, name);
                }
            }
            else
            {
                creatureRoom.AddCreature(type, name);
            }
        }