public void GenerateCustomSpecificShield()
        {
            var name     = Guid.NewGuid().ToString();
            var template = itemVerifier.CreateRandomTemplate(name);

            var shields = new[] { "other shield", name };

            mockCollectionsSelector.Setup(s => s.SelectFrom(TableNameConstants.Collections.Set.ItemGroups, AttributeConstants.Shield)).Returns(shields);

            var armors = new[] { "other armor", "armor" };

            mockCollectionsSelector.Setup(s => s.SelectFrom(TableNameConstants.Collections.Set.ItemGroups, ItemTypeConstants.Armor)).Returns(armors);

            var weapons = new[] { "other weapon", "weapon" };

            mockCollectionsSelector.Setup(s => s.SelectFrom(TableNameConstants.Collections.Set.ItemGroups, ItemTypeConstants.Weapon)).Returns(weapons);

            var attributes = new[] { "attribute 1", "attribute 2" };
            var tableName  = string.Format(TableNameConstants.Collections.Formattable.SpecificITEMTYPEAttributes, AttributeConstants.Shield);

            mockCollectionsSelector.Setup(s => s.SelectFrom(tableName, name)).Returns(attributes);

            var traits = new[] { "trait 1", "trait 2" };

            tableName = string.Format(TableNameConstants.Collections.Formattable.SpecificITEMTYPETraits, AttributeConstants.Shield);
            mockCollectionsSelector.Setup(s => s.SelectFrom(tableName, name)).Returns(traits);

            var specialAbilityNames = new[] { "ability 1", "ability 2" };

            tableName = string.Format(TableNameConstants.Collections.Formattable.SpecificITEMTYPESpecialAbilities, AttributeConstants.Shield);
            mockCollectionsSelector.Setup(s => s.SelectFrom(tableName, name)).Returns(specialAbilityNames);

            var specialAbilities = new[]
            {
                new SpecialAbility {
                    Name = template.Magic.SpecialAbilities.First().Name
                },
                new SpecialAbility {
                    Name = template.Magic.SpecialAbilities.Last().Name
                }
            };

            mockSpecialAbilitiesGenerator.Setup(s => s.GenerateFor(specialAbilityNames)).Returns(specialAbilities);

            var gear = specificGearGenerator.GenerateFrom(template);

            itemVerifier.AssertMagicalItemFromTemplate(gear, template);
            Assert.That(gear.ItemType, Is.EqualTo(ItemTypeConstants.Armor));
            Assert.That(gear.Attributes, Is.EqualTo(attributes));
            Assert.That(gear.Traits, Is.EquivalentTo(traits.Union(template.Traits)));
            Assert.That(gear.Magic.SpecialAbilities, Is.EqualTo(specialAbilities));
        }
Exemplo n.º 2
0
        public void CopyItem()
        {
            var name     = Guid.NewGuid().ToString();
            var template = itemVerifier.CreateRandomTemplate(name);

            template.ItemType = Guid.NewGuid().ToString();
            template.Magic.SpecialAbilities = new[]
            {
                new SpecialAbility {
                    Name = Guid.NewGuid().ToString()
                },
                new SpecialAbility {
                    Name = Guid.NewGuid().ToString()
                }
            };

            template.Attributes = new[] { Guid.NewGuid().ToString(), Guid.NewGuid().ToString() };

            var copy = template.Copy();

            itemVerifier.AssertMagicalItemFromTemplate(copy, template);
            Assert.That(copy.ItemType, Is.EqualTo(template.ItemType));
            Assert.That(copy.Magic.SpecialAbilities, Is.Empty);
            Assert.That(copy.Attributes, Is.EquivalentTo(template.Attributes));
        }