Exemplo n.º 1
0
 public Item(Item item)
 {
     Name = item.Name;
     Description = item.Description;
     Value = item.Value;
     Weight = item.Weight;
 }
Exemplo n.º 2
0
        public void ItemEquals()
        {
            Item target = new Item("Bucket", 5, 15);
            target.Description = "Big bucket.";
            Item item = new Item("Bucket", 5, 15);
            item.Description = "Big bucket.";

            Assert.IsFalse(target.Equals(null));
            Assert.IsFalse(target.Equals(new object()));

            Assert.IsTrue(target.Equals(item));
            item.Name = "Paper";
            Assert.IsFalse(target.Equals(item));
            item.Name = "Bucket";
            item.Description = "Small bucket.";
            Assert.IsFalse(target.Equals(item));
            item.Description = "Big bucket.";
            item.Value = 10;
            Assert.IsFalse(target.Equals(item));
            item.Value = 5;
            item.Weight = 20;
            Assert.IsFalse(target.Equals(item));
            item.Weight = 15;
            Assert.IsTrue(target.Equals(item));
        }
Exemplo n.º 3
0
        public void ItemCopyConstructor()
        {
            Item item = new Item("Bucket", 5, 15);
            Item target = new Item(item);

            Assert.IsTrue(item.Equals(target));
        }
        public void CharacterEncumbranceBasicLift()
        {
            Character target = new Character();

            Item item = new Item("Item 1", 0, 25);

            target.Inventory.Add(item);
            Assert.AreEqual(1, target.Encumbrance);
            target.StrengthPoints = 2; // BasicLift == 29
            Assert.AreEqual(0, target.Encumbrance);
        }
        public void CharacterEncumbranceLevels()
        {
            Character target = new Character();

            Item item1 = new Item("Item 1", 0, 15);
            Item item2 = new Item("Item 1", 0, 20);
            Item item3 = new Item("Item 1", 0, 60);

            target.Inventory.Add(item1);
            Assert.AreEqual(0, target.Encumbrance);
            target.Inventory.Add(item2);
            Assert.AreEqual(1, target.Encumbrance);
            target.Inventory.Add(item3);
            Assert.AreEqual(3, target.Encumbrance);
        }
        public void CharacterMoveNotNegative()
        {
            Character target = new Character();
            target.BasicMovePoints = -4;

            Item item1 = new Item("Item 1", 0, 15);
            Item item2 = new Item("Item 2", 0, 20);
            Item item3 = new Item("Item 3", 0, 20);

            target.Inventory.Add(item1);
            Assert.AreEqual(1, target.Move);
            target.Inventory.Add(item2);
            Assert.AreEqual(1, target.Move);
            target.Inventory.Add(item3);
            Assert.AreEqual(1, target.Move);
        }
        public void CharacterMove()
        {
            Character target = new Character();

            Item item1 = new Item("Item 1", 0, 15);
            Item item2 = new Item("Item 2", 0, 20);
            Item item3 = new Item("Item 3", 0, 20);

            target.Inventory.Add(item1);
            Assert.AreEqual(5, target.Move);
            target.Inventory.Add(item2);
            Assert.AreEqual(4, target.Move);
            target.Inventory.Add(item3);
            Assert.AreEqual(3, target.Move);
        }