예제 #1
0
        public void GiveThePlayerNothingWhenTheItemDoesNotExist()
        {
            _zoneConfig = ZoneBuilder.Build("Truman Brewery Hall 1");
            var item = _zoneConfig.GetItem("Blue Key");

            Assert.Null(item);
        }
예제 #2
0
        public IZoneConfiguration GetNextZone(IZoneConfiguration currentZone, Direction direction)
        {
            if (currentZone.GetZoneName() == "StartingZone" && direction == Direction.N)
            {
                return(ZoneBuilder.Build("Truman Brewery Hall 1"));
            }

            if (currentZone.GetZoneName() == "Truman Brewery Hall 1" && direction == Direction.S)
            {
                return(ZoneBuilder.Build("StartingZone"));
            }

            if (currentZone.GetZoneName() == "Truman Brewery Hall 1" && direction == Direction.E)
            {
                return(ZoneBuilder.Build("Truman Brewery Hall 2"));
            }

            if (currentZone.GetZoneName() == "Truman Brewery Hall 2" && direction == Direction.W)
            {
                return(ZoneBuilder.Build("Truman Brewery Hall 1"));
            }

            if (currentZone.GetZoneName() == "Truman Brewery Hall 2" && direction == Direction.N)
            {
                return(ZoneBuilder.Build("Truman Brewery Warehouse"));
            }

            throw new NotImplementedException();
        }
예제 #3
0
        public void TellThePlayerTheDoorDirectionIsUnknownWhenTheDoorDoesNotExist()
        {
            _zoneConfig = ZoneBuilder.Build("StartingZone");
            var doorDirection = _zoneConfig.GetDoorDirection("Blue Door");

            Assert.Equal(Direction.Unknown, doorDirection);
        }
예제 #4
0
        public void GiveThePlayerTheItemItRequested()
        {
            _zoneConfig = ZoneBuilder.Build("Truman Brewery Hall 1");
            var item = _zoneConfig.GetItem("White Key");

            Assert.Equal("White Key", item.GetName());
        }
예제 #5
0
        public void TellThePlayerTheresAWhiteDoorNorthOfTheStartingZone()
        {
            _zoneConfig = ZoneBuilder.Build("StartingZone");
            var message = _zoneConfig.LookAtDirection(Direction.N);

            Assert.Equal("I CAN SEE A BRICK BUILDING WITH A SIGN SAYING \"TRUMAN BREWERY\" AND A WOODEN WHITE DOOR", message.ToString());
        }
예제 #6
0
        public void TellThePlayerWhereTheDoorIsLocated()
        {
            _zoneConfig = ZoneBuilder.Build("StartingZone");
            var doorDirection = _zoneConfig.GetDoorDirection("White Door");

            Assert.Equal(Direction.N, doorDirection);
        }
예제 #7
0
        public void TellThePlayerTheDescriptionOfWhateverIsSouth()
        {
            _zoneConfig = ZoneBuilder.Build("StartingZone");
            var message = _zoneConfig.LookAtDirection(Direction.S);

            Assert.Equal("Nothing interesting to look at there!", message.ToString());
        }
예제 #8
0
        public void TellThePlayerTheDescriptionOfTheZone()
        {
            _zoneConfig = ZoneBuilder.Build("StartingZone");
            var message = _zoneConfig.LookAtDirection();

            Assert.Equal("LOST IN SHOREDITCH.\r\nYOU ARE STANDING AT THE END OF BRICK LANE BEFORE A SMALL BRICK BUILDING CALLED THE OLD TRUMAN BREWERY. \r\nAROUND YOU IS A FOREST OF INDIAN RESTAURANTS. \r\nA SMALL STREAM OF CRAFTED BEER FLOWS OUT OF THE BUILDING AND DOWN A GULLY.",
                         message.ToString());
        }
예제 #9
0
 public Message Go(Direction direction)
 {
     _startingZone = _zoneSwitcher.GetNextZone(_startingZone, direction);
     return(ZoneOverview());
 }
예제 #10
0
 public StartingPlayer(IZoneConfiguration startingZone, IZoneSwitcher zoneSwitcher)
 {
     _startingZone = startingZone;
     _zoneSwitcher = zoneSwitcher;
 }
예제 #11
0
 public void TellTheUserTheDoorDoesNotExists()
 {
     _zoneConfig = ZoneBuilder.Build("StartingZone");
     Assert.False(_zoneConfig.DoesDoorExist("Red Door"));
 }
예제 #12
0
 public void TellTheUserTheDoorExists()
 {
     _zoneConfig = ZoneBuilder.Build("StartingZone");
     Assert.True(_zoneConfig.DoesDoorExist("White Door"));
 }
예제 #13
0
 public void TellTheUserTheDoorIsOpenWhenTheWhiteDoorIsUnlocked()
 {
     _zoneConfig = ZoneBuilder.Build("StartingZone");
     Assert.True(_zoneConfig.IsDoorUnlocked("White Door"));
 }