Beispiel #1
0
        public void Default()
        {
            // Arrange
            var character = Mock.Of <ICharacter>();
            EquipmentSection equipmentSection = new EquipmentSection(character);

            // Act
            var(ring1, ring2) = equipmentSection.Rings;

            // Assert
            Assert.IsNull(equipmentSection.Armor);
            Assert.IsNull(equipmentSection.Belt);
            Assert.IsNull(equipmentSection.Body);
            Assert.IsNull(equipmentSection.Chest);
            Assert.IsNull(equipmentSection.Eyes);
            Assert.IsNull(equipmentSection.Feet);
            Assert.IsNull(equipmentSection.Hands);
            Assert.IsNull(equipmentSection.Head);
            Assert.IsNull(equipmentSection.Headband);
            Assert.IsNull(equipmentSection.Neck);
            Assert.IsNull(ring1);
            Assert.IsNull(ring2);
            Assert.IsNull(equipmentSection.Shield);
            Assert.IsNull(equipmentSection.Shoulders);
            Assert.IsNull(equipmentSection.Spellbook);
            Assert.IsNull(equipmentSection.Wrists);
            Assert.IsEmpty(equipmentSection.GetInventory());
        }
Beispiel #2
0
        public void StowIStowable_HappyPath()
        {
            // Arrange
            var character = Mock.Of <ICharacter>();
            var item      = Mock.Of <IStowable>();
            EquipmentSection equipmentSection = new EquipmentSection(character);

            // Act
            equipmentSection.Stow(item);

            // Assert
            Assert.Contains(item, equipmentSection.GetInventory(),
                            "Stowing an item should create a reference in the equipment section's GetInventory collection.");
            Mock.Get(item)
            .Verify(i => i.ApplyTo(It.Is <ICharacter>(c => c == character)),
                    "Stowing the item should call the item's .ApplyTo method, passing in the character as an argument.");
        }