示例#1
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();
        }
示例#2
0
        public void GiveThePlayerTheItemItRequested()
        {
            _zoneConfig = ZoneBuilder.Build("Truman Brewery Hall 1");
            var item = _zoneConfig.GetItem("White Key");

            Assert.Equal("White Key", item.GetName());
        }
示例#3
0
        public void GiveThePlayerNothingWhenTheItemDoesNotExist()
        {
            _zoneConfig = ZoneBuilder.Build("Truman Brewery Hall 1");
            var item = _zoneConfig.GetItem("Blue Key");

            Assert.Null(item);
        }
示例#4
0
        public void TellThePlayerWhereTheDoorIsLocated()
        {
            _zoneConfig = ZoneBuilder.Build("StartingZone");
            var doorDirection = _zoneConfig.GetDoorDirection("White Door");

            Assert.Equal(Direction.N, doorDirection);
        }
示例#5
0
        public void TellThePlayerTheDoorDirectionIsUnknownWhenTheDoorDoesNotExist()
        {
            _zoneConfig = ZoneBuilder.Build("StartingZone");
            var doorDirection = _zoneConfig.GetDoorDirection("Blue Door");

            Assert.Equal(Direction.Unknown, doorDirection);
        }
示例#6
0
        public void TellThePlayerTheDescriptionOfWhateverIsSouth()
        {
            _zoneConfig = ZoneBuilder.Build("StartingZone");
            var message = _zoneConfig.LookAtDirection(Direction.S);

            Assert.Equal("Nothing interesting to look at there!", message.ToString());
        }
示例#7
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());
        }
示例#8
0
        public void MoveToTheTrumanBreweryFromTheStartingZone()
        {
            var zoneSwitcher = new ZoneSwitcher();
            var firstZone    = ZoneBuilder.Build("StartingZone");
            var zone         = zoneSwitcher.GetNextZone(firstZone, Direction.N);

            Assert.Equal("Truman Brewery Hall 1", zone.GetZoneName());
        }
示例#9
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());
        }
示例#10
0
        public void MoveToTheTrumanBreweryThenMoveBackToTheStartingZone()
        {
            var zoneSwitcher = new ZoneSwitcher();
            var firstZone    = ZoneBuilder.Build("StartingZone");
            var secondZone   = zoneSwitcher.GetNextZone(firstZone, Direction.N);
            var thirdZone    = zoneSwitcher.GetNextZone(secondZone, Direction.S);

            Assert.Equal("StartingZone", thirdZone.GetZoneName());
        }
示例#11
0
        public void PlayerLooksSouthThenLooksNorthOpensDoorPicksUpKeysOpensBagGoesNorthFailsLooksEastGoesEastUseKeyOpenDoor()
        {
            var player = new StartingPlayer(ZoneBuilder.Build("StartingZone"), new ZoneSwitcher());

            _katacombs = new Katacombs(player);
            _katacombs.Start();
            _katacombs.Action("Look S");
            _katacombs.Action("Look N");
            _katacombs.Action("Open White Door");
            _katacombs.Action("Take Key");
            _katacombs.Action("Bag");
            _katacombs.Action("Go E");
            _katacombs.Action("Use Key");
            var message = _katacombs.Action("Open White Door");

            Assert.Equal("Inside Truman Brewery's warehouse.\r\nYou're inside a warehouse filled with rows of beer kegs. You smell the putrid odor of death.", message.ToString());
        }
示例#12
0
 public void TellTheUserTheDoorDoesNotExists()
 {
     _zoneConfig = ZoneBuilder.Build("StartingZone");
     Assert.False(_zoneConfig.DoesDoorExist("Red Door"));
 }
示例#13
0
 public void TellTheUserTheDoorExists()
 {
     _zoneConfig = ZoneBuilder.Build("StartingZone");
     Assert.True(_zoneConfig.DoesDoorExist("White Door"));
 }
示例#14
0
 public void TellTheUserTheDoorIsOpenWhenTheWhiteDoorIsUnlocked()
 {
     _zoneConfig = ZoneBuilder.Build("StartingZone");
     Assert.True(_zoneConfig.IsDoorUnlocked("White Door"));
 }