Ejemplo n.º 1
0
        public void TestLookCommandForLocation()
        {
            _player = new Player("tony", "The best chef");
            foreach (Item i in new List <Item> {
                _shovel, _sword, _torch
            })
            {
                _player.Location.Inventory.Put(i);
            }

            List <string> listText = new List <string> {
                "look", "at", "sword"
            };

            LookCommand command = new LookCommand();

            string stringTest = _sword.FullDescription;

            Assert.AreEqual
            (
                stringTest,
                command.Execute(_player, listText),
                "Testing the look command returns a format like stringTest"
            );
        }
Ejemplo n.º 2
0
        public void TestLookAtMe()
        {
            LookCommand look       = new LookCommand();
            Player      testPlayer = new Player("James", "Deer hunter");

            Assert.AreEqual("You are not carrying anything", look.Execute(testPlayer, new String[] { "look", "at", "inventory" }), "Test look at me");
        }
Ejemplo n.º 3
0
 public void Before_Each_Test()
 {
     mock           = MockRepository.GenerateMock <IConsoleFacade>();
     roomRepository = MockRepository.GenerateMock <IRepository <Room> >();
     itemRepository = MockRepository.GenerateMock <IRepository <Item> >();
     cmd            = new LookCommand(mock, roomRepository, itemRepository);
 }
Ejemplo n.º 4
0
        public void Setup()
        {
            _lookCommand = new LookCommand();
            _player      = new Player("Varg", "The Enflamer");
            _bag         = new Bag(
                new [] { "bag" },
                "Netherweave Bag",
                "A hand crafted elven bag."
                );

            string[] identsGun = { "Weapon", "BFG", "Rocket Launcher" };
            _weapon = new Item(identsGun,
                               "Big Friggin Gun",
                               "The biggest gun available in the game"
                               );

            string[] identsArmour = { "Armour", "Platemail", "Heavy Armour" };
            _armour = new Item(identsArmour,
                               "Illidan's Plated Glory",
                               "Tier 9 Epic Plate Mail"
                               );

            string[] identsConsumables = { "Food", "Consumable", "Health Regeneration" };
            _food = new Item(identsConsumables,
                             "Kiwifruit Pie",
                             "Heals Player on consumption for 2000 hp over 12 seconds"
                             );

            _gem = new Item(
                new string[] { "gem" },
                "Eye of Azeroth",
                "Enables smiting of Alliance scum regardless of PvP status."
                );
        }
Ejemplo n.º 5
0
 protected void GetInfo(object obj, EventArgs args)
 {
     if (_playername == "")
     {
         _playername = playerText.Text;
         _player.AddIdentifier(_playername);
         playerText.Text = "";
         playerText.Hide();
         descText.Show();
         TextArea.Buffer.Text = "Tell me something about yourself";
     }
     else if (!IsEmpty(descText.Text) && !IsEmpty(_playername))
     {
         _desc = descText.Text;
         _player.Description = _desc;
         descText.Text       = "";
         descText.Hide();
         commandText.Show();
         TextArea.Buffer.Text = "Enter commands or type quit to exit";
     }
     else
     {
         string           command       = commandText.Text.ToLower();
         char             delimiterChar = ' ';
         string[]         cmd           = command.Split(delimiterChar);
         LookCommand      look          = new LookCommand(new string[] { "look" });
         MoveCommand      move          = new MoveCommand(new string[] { "move", "go", "head", "leave" });
         PutCommand       put           = new PutCommand(new string[] { "put", "drop" });
         TakeCommand      take          = new TakeCommand(new string[] { "pickup", "take" });
         CommandProcessor cp            = new CommandProcessor(new string[] { }, new Command[] { look, move, put, take });
         TextArea.Buffer.Text = cp.Execute(_player, cmd);
     }
 }
Ejemplo n.º 6
0
        public void TestLookAtGemInNoBag()
        {
            LookCommand look       = new LookCommand();
            Player      testPlayer = new Player("James", "Deer hunter");

            Assert.AreEqual("I cannot find the bag", look.Execute(testPlayer, new String[] { "look", "at", "shovel", "in", "bag" }), "test look cannot find the container");
        }
Ejemplo n.º 7
0
        public void TestLookAtGemInMe()
        {
            LookCommand look       = new LookCommand();
            Player      testPlayer = new Player("James", "Deer hunter");

            Assert.AreEqual("I cannot find the gun", look.Execute(testPlayer, new String[] { "look", "at", "gun", "in", "inventory" }), "test look at item in inventory");
        }
Ejemplo n.º 8
0
        public void TestLookAtGem()
        {
            LookCommand look       = new LookCommand();
            Player      testPlayer = new Player("James", "Deer hunter");

            testPlayer.Inventory.Put(new Item(new String[] { "gun", "rifle" }, "a gun", "This is a killing tool ..."));
            Assert.AreEqual("This is a killing tool ...", look.Execute(testPlayer, new String[] { "look", "at", "gun" }), "test look at item in inventory");
        }
Ejemplo n.º 9
0
        public void TestLookAtNoGemInBag()
        {
            LookCommand look       = new LookCommand();
            Player      testPlayer = new Player("James", "Deer hunter");
            Bag         testBag    = new Bag(new string[] { "Bag", "Backpack" }, "a bag", "This is a bag for....");

            testPlayer.Inventory.Put(testBag);
            Assert.AreEqual("I cannot find the shovel in the bag", look.Execute(testPlayer, new String[] { "look", "at", "shovel", "in", "bag" }), "test look cannot find item in the container");
        }
        public void TestLookAtUnk()
        {
            LookCommand command  = new LookCommand();
            Player      player   = new Player("player one", "i am player one");
            var         test     = command.Execute(player, new string[] { "look", "at", "gem" });
            var         expected = "I cannot find the gem";

            Assert.True(test == expected, "The command can't find nothing");
        }
Ejemplo n.º 11
0
        public void TestInvalidLook()
        {
            Player      TestPlayer = new Player("TestPlayer", "For testing");
            LookCommand TestLook   = new LookCommand();

            Assert.IsTrue(TestLook.Execute(TestPlayer, new string[1] {
                "hello"
            }) == "i don't know how to look like that");
        }
Ejemplo n.º 12
0
        public void TestInvalidLook()
        {
            LookCommand look       = new LookCommand();
            Player      testPlayer = new Player("James", "Deer hunter");

            Assert.AreEqual("I don't know how to look like that", look.Execute(testPlayer, new String[] { "look", "down" }), "test invalid look command");
            Assert.AreEqual("Error in look input", look.Execute(testPlayer, new String[] { "hello", "deer", "hunter" }), "test invalid look command");
            Assert.AreEqual("What do you want to look in?", look.Execute(testPlayer, new String[] { "look", "at", "drink", "about", "me" }), "test invalid look command");
            Assert.AreEqual("What do you want to look at?", look.Execute(testPlayer, new String[] { "look", "over", "that" }), "test invalid look command");
        }
Ejemplo n.º 13
0
        public void TestLookAtGemInBag()
        {
            LookCommand look       = new LookCommand();
            Player      testPlayer = new Player("James", "Deer hunter");
            Bag         testBag    = new Bag(new string[] { "Bag", "Backpack" }, "a bag", "This is a bag for....");

            testBag.Inventory.Put(new Item(new String[] { "shovel", "spade" }, "a shovel", "This is a might fine ..."));
            testPlayer.Inventory.Put(testBag);
            Assert.AreEqual("This is a might fine ...", look.Execute(testPlayer, new String[] { "look", "at", "shovel", "in", "bag" }), "test look returns items description");
        }
Ejemplo n.º 14
0
        private void Start()
        {
            worldManager  = GameObject.Find("WorldManager").GetComponent <WorldManager>();
            playerManager = this.gameObject.GetComponentInParent <PlayerManager>();

            move     = new MoveCommand();
            look     = new LookCommand();
            useItem  = new UseItemCommand();
            swapItem = new SwapItemCommand();
        }
        public void LookCommandTestSetup()
        {
            testLocation    = new Location(new string[] { "Test" }, "Test Area", "Such test!");
            testPlayer      = new Player("Luke", "The Amazing one!", testLocation);
            testLookCommand = new LookCommand();
            testItem        = new Item(new string[] { "Shiny" }, "Gem", "A shiny gem");
            testBag         = new Bag(new string[] { "Large" }, "Bag", "A large leather bag");

            testPlayer.Inventory.Put(testItem);
            testPlayer.Inventory.Put(testBag);
        }
Ejemplo n.º 16
0
 public override bool Move(Direction dir)
 {
     if (base.Move(dir))
     {
         // We successfully moved!
         // Let's print our new location.
         LookCommand.Print(Location);
         return(true);
     }
     return(false);
 }
Ejemplo n.º 17
0
        public void TestLookAtGemInMe()
        {
            Player TestPlayer = new Player("Adeepa", "Test");
            Item   TestItem   = new Item(new string[] { "baked", "potato" }, "Gem", "A Shiny Gem");

            TestPlayer.Inventory.PutItem(TestItem);
            LookCommand TestLook = new LookCommand();

            Assert.IsTrue(TestLook.Execute(TestPlayer, new string[5] {
                "look", "at", "potato", "in", "me"
            }) == TestItem.LongDesc);
        }
Ejemplo n.º 18
0
        public void TestLookAtMe()
        {
            Player TestPlayer = new Player("Adeepa", "Test");

            LookCommand TestLook = new LookCommand();

            Console.WriteLine(TestLook.Execute(TestPlayer, new string[3] {
                "look", "at", "me"
            }));
            Assert.IsTrue(TestLook.Execute(TestPlayer, new string[3] {
                "look", "at", "me"
            }) == TestPlayer.LongDesc);
        }
        public void Init()
        {
            playerInput = new ParsedInput("look", new ArrayList());
            thePlayer   = new Player("greg");
            t127        = new Location("a lecture theatre", "T127", new NonPlayerCharacter("Johnny", "heyo", false));
            Location gregsoffice = new Location("a spinning vortex of terror", "Greg's Office", new NonPlayerCharacter("Johnny", "heyo", false));

            southExit = new Exit("you see a mound of paper to the south", gregsoffice);
            t127.GetExitCollection().AddExit("south", southExit);
            thePlayer.CurrentLocation = t127;
            handler = new CommandHandler();
            look    = new LookCommand();
        }
        public void TestLookAtGem()
        {
            LookCommand command = new LookCommand();
            Player      player  = new Player("player one", "i am player one");
            Item        gem     = new Item(new string[] { "gem" }, "a Gem", "Desc for Gem");

            player.Inventory.Put(gem);
            Assert.True(command.Execute(
                            player,
                            new string[] { "look", "at", "gem" }) ==
                        gem.FullDescription,
                        "The Look command can't look at item");
        }
        public void TestLookAtGemInNoBag()
        {
            LookCommand command = new LookCommand();
            Player      player  = new Player("player one", "i am player one");
            string      test    = command.Execute(player, new string[]
            {
                "look", "at", "gem", "in", "bag"
            });
            string expected = "I cannot find the bag";

            Assert.True(expected == test,
                        "Can't generate errors for no bag");
        }
Ejemplo n.º 22
0
        public void TestLookAtGemInNoBag()
        {
            Player TestPlayer = new Player("Adeepa", "Test");
            Item   TestItem   = new Item(new string[] { "gem", "Shiny" }, "Gem", "A Shiny Gem");
            Bag    TestBag    = new Bag(new string[] { "bag", "test" }, "Test Bag", "A Testing Bag");

            TestBag.Inventory.PutItem(TestItem);
            TestPlayer.Inventory.PutItem(TestBag);
            LookCommand TestLook = new LookCommand();

            Assert.IsTrue(TestLook.Execute(TestPlayer, new string[5] {
                "look", "at", "gem", "in", "nobag"
            }) == "i cannot find the nobag");
        }
Ejemplo n.º 23
0
        public void LookTest()
        {
            Player John = new Player("John", "Random Player");

            LookCommand TestLook = new LookCommand();

            CommandProcessor TestProcessor = new CommandProcessor();

            TestProcessor.AddCommand(TestLook);

            Console.WriteLine(TestProcessor.Execute(John, new string[] { "look", "at", "me" }));

            Assert.AreEqual(John.FullDescription, TestProcessor.Execute(John, new string[] { "look", "at", "me" }));
        }
        public void TestLookAtNoGemInBag()
        {
            Bag         bag     = new Bag(new string[] { "chest" }, "Chest", "this is desc");
            LookCommand command = new LookCommand();
            Player      player  = new Player("player one", "i am player one");

            player.Inventory.Put(bag);
            string test = command.Execute(player, new string[]
            {
                "look", "at", "gem", "in", "chest"
            });
            string expected = "I cannot find the gem in the Chest";

            Assert.True(expected == test,
                        "Can't generate errors for no gem in the ");
        }
        public void TestLookAtGemInMe()
        {
            LookCommand command = new LookCommand();
            Player      player  = new Player("player one", "i am player one");
            Item        Gem     = new Item(new string[] { "gem" }, "a Gem", "Desc for Gem");

            player.Inventory.Put(Gem);
            string test = command.Execute(player, new string[]
            {
                "look", "at", "gem", "in", "inventory"
            });
            string expected = Gem.FullDescription;

            Assert.True(test == expected,
                        "can't look at gem in inventory");
        }
Ejemplo n.º 26
0
        public void TestLookAtGem()
        {
            List <string> listText = new List <string> {
                "look", "at", "gem"
            };

            LookCommand command = new LookCommand();

            string stringTest = _mygem.FullDescription;

            Assert.AreEqual
            (
                stringTest,
                command.Execute(_player, listText),
                "Testing the look command returns a format like stringTest"
            );
        }
Ejemplo n.º 27
0
        public void TestLookAtMe()
        {
            List <string> listText = new List <string> {
                "look", "at", "me"
            };

            LookCommand command = new LookCommand();

            string stringTest = "You are player the mighty programmer \n You are carrying: \n" + _player.Inventory.ItemList;

            Assert.AreEqual
            (
                stringTest,
                command.Execute(_player, listText),
                "Testing the look command returns a format like stringTest"
            );
        }
Ejemplo n.º 28
0
        public void TestMisspelledLook()
        {
            List <string> listText = new List <string> {
                "lok", "at", "gem", "in", "bag"
            };

            LookCommand command = new LookCommand();

            string stringtest = "Error in look input";

            Assert.AreEqual
            (
                stringtest,
                command.Execute(_player, listText),
                "testing the look command returns a format like stringtest"
            );
        }
Ejemplo n.º 29
0
        public void TestInvalidLookAt()
        {
            List <string> listText = new List <string> {
                "look", "in", "a", "in", "b"
            };

            LookCommand command = new LookCommand();

            string stringtest = "What do you want to look at?";

            Assert.AreEqual
            (
                stringtest,
                command.Execute(_player, listText),
                "testing the look command returns a format like stringtest"
            );
        }
Ejemplo n.º 30
0
        public void TestInvalidUnk()
        {
            List <string> listText = new List <string> {
                "hello"
            };

            LookCommand command = new LookCommand();

            string stringtest = "I don't know how to look for that";

            Assert.AreEqual
            (
                stringtest,
                command.Execute(_player, listText),
                "testing the look command returns a format like stringtest"
            );
        }