Example #1
0
        public void TellThePlayerTheDoorDirectionIsUnknownWhenTheDoorDoesNotExist()
        {
            _zoneConfig = ZoneBuilder.Build("StartingZone");
            var doorDirection = _zoneConfig.GetDoorDirection("Blue Door");

            Assert.Equal(Direction.Unknown, doorDirection);
        }
Example #2
0
        public void TellThePlayerWhereTheDoorIsLocated()
        {
            _zoneConfig = ZoneBuilder.Build("StartingZone");
            var doorDirection = _zoneConfig.GetDoorDirection("White Door");

            Assert.Equal(Direction.N, doorDirection);
        }
Example #3
0
        public Message Open(string door)
        {
            if (!_startingZone.DoesDoorExist(door))
            {
                return(new Message("There's no door"));
            }

            var doorIsUnlocked = _startingZone.IsDoorUnlocked(door);

            if (doorIsUnlocked)
            {
                return(Go(_startingZone.GetDoorDirection(door)));
            }

            return(new Message("There's no door"));
        }