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

            var specificItems = new[] { "other item", name };

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

            var isSpecific = specificGearGenerator.TemplateIsSpecific(template);

            Assert.That(isSpecific, Is.True);
        }
        public Item Generate(Item template, bool allowRandomDecoration = false)
        {
            template.ItemType = ItemTypeConstants.Weapon;
            var weapon = template.Copy();

            if (specificGearGenerator.TemplateIsSpecific(template))
            {
                weapon = specificGearGenerator.GenerateFrom(template);
            }
            else if (ammunitionGenerator.TemplateIsAmmunition(template))
            {
                weapon = ammunitionGenerator.GenerateFrom(template);
            }
            else
            {
                var tableName = string.Format(TableNameConstants.Collections.Formattable.ITEMTYPEAttributes, weapon.ItemType);
                weapon.Attributes = collectionsSelector.SelectFrom(tableName, weapon.Name);
            }

            var abilityNames = template.Magic.SpecialAbilities.Select(a => a.Name);

            weapon.Magic.SpecialAbilities = specialAbilitiesGenerator.GenerateFor(abilityNames);

            return(weapon);
        }
        public Item Generate(Item template, bool allowRandomDecoration = false)
        {
            var armor = template.Copy();

            if (specificGearGenerator.TemplateIsSpecific(template))
            {
                armor = specificGearGenerator.GenerateFrom(template);
            }
            else
            {
                armor.ItemType = ItemTypeConstants.Armor;
                armor.Quantity = 1;

                var tableName = string.Format(TableNameConstants.Collections.Formattable.ITEMTYPEAttributes, armor.ItemType);
                armor.Attributes = collectionsSelector.SelectFrom(tableName, armor.Name);
            }

            armor.Quantity = 1;

            var specialAbilityNames = template.Magic.SpecialAbilities.Select(a => a.Name);

            armor.Magic.SpecialAbilities = specialAbilitiesSelector.GenerateFor(specialAbilityNames);

            return(armor);
        }