public void Get_all_from_room() { var apple = new GameLogic.Item.Item(); apple.Name = "apple"; apple.Description = new Description() { Room = "apple" }; var room = new Room(); room.Items.Add(apple); 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.Get("all", "", room, player, "get all"); Assert.True(room.Items.FirstOrDefault(x => x.Name == "apple") == null); }
public void Add_Gold_to_player() { var item = new GameLogic.Item.Item { Name = "gold", Description = new Description() { Room = "gold" }, Value = 5, ItemType = GameLogic.Item.Item.ItemTypes.Money }; var room = new Room(); room.Items.Add(item); var player = new Player(); player.ConnectionId = "1"; player.Name = "Gary"; player.Inventory = new ItemList(); player.Money = new GameLogic.Character.Model.Money(); var objects = new GameLogic.Commands.Objects.Object(_IWriteToClient.Object, _IUpdateUI.Object, _IMobScripts.Object); objects.Get("gold", "", room, player, "get gold"); Assert.True(player.Money.Gold.Equals(5)); }
public void Get_item_container_weight_of_item_should_not_be_that_of_the_container() { var apple = new GameLogic.Item.Item(); apple.Name = "apple"; apple.Description = new Description() { Room = "apple" }; apple.Weight = 0.5F; var chest = new GameLogic.Item.Item { Name = "chest", Container = new Container() { Items = new ItemList { apple }, IsOpen = true }, Weight = 5 }; var room = new Room(); room.Items.Add(chest); 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.Get("apple", "chest", room, player, "get apple chest"); Assert.True(player.Inventory.FirstOrDefault(x => x.Name == "apple").Weight == 0.5); }
public void Get_item_container() { var apple = new GameLogic.Item.Item(); apple.Name = "apple"; apple.Description = new Description() { Room = "apple" }; var chest = new GameLogic.Item.Item { Name = "chest", Container = new Container() { Items = new ItemList { apple }, IsOpen = true } }; var room = new Room(); room.Items.Add(chest); 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); objects.Get("apple", "chest", room, player); Assert.True(chest.Container.Items.FirstOrDefault(x => x.Name == "apple") == null); }