Esempio n. 1
0
        public void Should_open_closed_Container()
        {
            var item = new GameLogic.Item.Item
            {
                Name        = "Chest",
                Description = new Description(),

                ItemType  = GameLogic.Item.Item.ItemTypes.Container,
                Container = new Container()
                {
                    CanOpen = true, IsOpen = false, Items = new ItemList()
                },
            };

            var room = new Room();

            room.Items.Add(item);

            var player = new Player();

            player.ConnectionId = "1";
            player.Name         = "Gary";
            player.Inventory    = new ItemList();


            var objects = new GameLogic.Commands.Objects.Object(_IWriteToClient.Object, _IUpdateUI.Object, _IMobScripts.Object);

            objects.Open("chest", room, player);

            _IWriteToClient.Verify(w => w.WriteLine(It.Is <string>(s => s.Contains("You open")), "1"), Times.Once());
            Assert.True(item.Container.IsOpen);
        }
Esempio n. 2
0
        public void Should_open_closed_door()
        {
            var exit = new Exit();

            exit.Name   = "North";
            exit.Closed = true;
            var room = new Room();

            room.Exits.North = exit;

            var player = new Player();

            player.ConnectionId = "1";
            player.Name         = "Gary";
            player.Inventory    = new ItemList();


            var objects = new GameLogic.Commands.Objects.Object(_IWriteToClient.Object, _IUpdateUI.Object, _IMobScripts.Object);

            objects.Open("north", room, player);

            _IWriteToClient.Verify(w => w.WriteLine(It.Is <string>(s => s.Contains("You open the door")), "1"), Times.Once());
        }