Ejemplo n.º 1
0
 public void Setup()
 {
     mockTypeAndAmountPercentileSelector = new Mock <ITypeAndAmountPercentileSelector>();
     alchemicalItemGenerator             = new AlchemicalItemGenerator(mockTypeAndAmountPercentileSelector.Object);
     selection    = new TypeAndAmountSelection();
     itemVerifier = new ItemVerifier();
 }
        public virtual void IntelligenceHappens()
        {
            var item = GenerateOrFail(GenerateItem, i => i.ItemType == itemType && i.Magic.Intelligence.Ego > 0);

            AssertItem(item);
            ItemVerifier.AssertIntelligence(item.Magic.Intelligence);
        }
        protected void AssertSpecificCursedItemsWithIntelligenceHappen()
        {
            var item = GenerateOrFail(GenerateItem, i => i.Magic.Curse == CurseConstants.SpecificCursedItem && i.Magic.Intelligence.Ego > 0);

            ItemVerifier.AssertSpecificCursedItem(item);
            ItemVerifier.AssertIntelligence(item.Magic.Intelligence);
        }
Ejemplo n.º 4
0
 public void Setup()
 {
     mockTypeAndAmountPercentileSelector = new Mock <ITypeAndAmountPercentileSelector>();
     generator    = new AlchemicalItemGenerator(mockTypeAndAmountPercentileSelector.Object);
     result       = new TypeAndAmountPercentileResult();
     itemVerifier = new ItemVerifier();
 }
        protected void AssertSpecificCursedItemsWithTraitsHappen()
        {
            var item = GenerateOrFail(GenerateItem, i => i.Magic.Curse == CurseConstants.SpecificCursedItem && i.Traits.Except(materials).Any());

            ItemVerifier.AssertSpecificCursedItem(item);
            Assert.That(item.Traits, Is.Not.Empty);
            Assert.That(item.Traits.Except(materials), Is.Not.Empty);
        }
        protected void AssertSpecificCursedItemsWithNoDecorationHappen()
        {
            var item = GenerateOrFail(GenerateItem, i => i.Magic.Curse == CurseConstants.SpecificCursedItem && i.Traits.Any() == false && i.Magic.Intelligence.Ego == 0);

            ItemVerifier.AssertSpecificCursedItem(item);
            Assert.That(item.Traits, Is.Empty);
            Assert.That(item.Magic.Intelligence.Ego, Is.EqualTo(0));
        }
Ejemplo n.º 7
0
 public void Setup()
 {
     mockPercentileSelector = new Mock <ITreasurePercentileSelector>();
     mockChargesGenerator   = new Mock <IChargesGenerator>();
     wandGenerator          = new WandGenerator(mockPercentileSelector.Object, mockChargesGenerator.Object);
     power        = "power";
     itemVerifier = new ItemVerifier();
 }
Ejemplo n.º 8
0
        public void IntelligentSpecificWeaponHappens()
        {
            var weapon = GenerateOrFail(GenerateItem, w => w.ItemType == itemType && w.Attributes.Contains(AttributeConstants.Specific) && w.Magic.Curse != CurseConstants.SpecificCursedItem && w.Magic.Intelligence.Ego > 0);

            AssertItem(weapon);
            Assert.That(weapon.Attributes, Contains.Item(AttributeConstants.Specific));
            Assert.That(weapon.Magic.Curse, Is.Not.EqualTo(CurseConstants.SpecificCursedItem));
            ItemVerifier.AssertIntelligence(weapon.Magic.Intelligence);
        }
Ejemplo n.º 9
0
        public void IntelligentSpecificArmorHappens()
        {
            var armor = GenerateOrFail(GenerateItem, a => a.ItemType == itemType && a.Attributes.Contains(AttributeConstants.Specific) && a.Magic.Curse != CurseConstants.SpecificCursedItem && a.Magic.Intelligence.Ego > 0);

            AssertItem(armor);
            Assert.That(armor.Attributes, Contains.Item(AttributeConstants.Specific));
            Assert.That(armor.Magic.Curse, Is.Not.EqualTo(CurseConstants.SpecificCursedItem));
            ItemVerifier.AssertIntelligence(armor.Magic.Intelligence);
        }
 public void Setup()
 {
     mockPercentileSelector        = new Mock <IPercentileSelector>();
     mockChargesGenerator          = new Mock <IChargesGenerator>();
     mockAttributesSelector        = new Mock <ICollectionsSelector>();
     mockSpecialAbilitiesGenerator = new Mock <ISpecialAbilitiesGenerator>();
     staffGenerator = new StaffGenerator(mockPercentileSelector.Object, mockChargesGenerator.Object, mockAttributesSelector.Object, mockSpecialAbilitiesGenerator.Object);
     power          = "power";
     itemVerifier   = new ItemVerifier();
 }
Ejemplo n.º 11
0
        public void Setup()
        {
            mockPercentileSelector = new Mock <IPercentileSelector>();
            mockAttributesSelector = new Mock <ICollectionsSelector>();
            mockDice            = new Mock <Dice>();
            ammunitionGenerator = new AmmunitionGenerator(mockPercentileSelector.Object, mockDice.Object, mockAttributesSelector.Object);
            itemVerifier        = new ItemVerifier();

            mockDice.Setup(d => d.Roll(1).d(100).AsSum()).Returns(0);
        }
        public void Setup()
        {
            mockInnerGenerator = new Mock <MagicalItemGenerator>();
            mockCurseGenerator = new Mock <ICurseGenerator>();
            decorator          = new MagicalItemGeneratorCurseDecorator(mockInnerGenerator.Object, mockCurseGenerator.Object);
            innerItem          = new Item();
            itemVerifier       = new ItemVerifier();

            mockInnerGenerator.Setup(g => g.GenerateAtPower("power")).Returns(innerItem);
        }
        protected void StressCustomItem()
        {
            var name     = GetRandomName();
            var template = GetRandomTemplate(name);

            var item = magicalItemGenerator.Generate(template);

            AssertItem(item);
            ItemVerifier.AssertMagicalItemFromTemplate(item, template);
        }
Ejemplo n.º 14
0
        public void Setup()
        {
            mockSpellGenerator = new Mock <ISpellGenerator>();
            mockDice           = new Mock <Dice>();
            scrollGenerator    = new ScrollGenerator(mockDice.Object, mockSpellGenerator.Object);

            itemVerifier = new ItemVerifier();

            mockDice.Setup(d => d.Roll(1).d(3).AsSum()).Returns(1);
        }
        protected void GenerateAndAssertCustomItem()
        {
            var name     = GetRandomName();
            var template = ItemVerifier.CreateRandomTemplate(name);

            var item = mundaneItemGenerator.Generate(template);

            AssertItem(item);
            Assert.That(item.Name, Is.EqualTo(name));
            ItemVerifier.AssertMundaneItemFromTemplate(item, template);
        }
        protected void StressCustomItem()
        {
            var names    = GetItemNames();
            var name     = GetRandom(names);
            var template = ItemVerifier.CreateRandomTemplate(name);

            var item = mundaneItemGenerator.Generate(template);

            AssertItem(item);
            ItemVerifier.AssertMundaneItemFromTemplate(item, template);
        }
Ejemplo n.º 17
0
        public void Setup()
        {
            mockPercentileSelector        = new Mock <IPercentileSelector>();
            mockAttributesSelector        = new Mock <ICollectionsSelector>();
            mockBooleanPercentileSelector = new Mock <IBooleanPercentileSelector>();
            mundaneArmorGenerator         = new MundaneArmorGenerator(mockPercentileSelector.Object, mockAttributesSelector.Object,
                                                                      mockBooleanPercentileSelector.Object);
            itemVerifier = new ItemVerifier();

            mockPercentileSelector.Setup(p => p.SelectFrom(TableNameConstants.Percentiles.Set.MundaneArmors)).Returns("armor type");
        }
        public void Setup()
        {
            mockDice = new Mock <Dice>();
            mockPercentileSelector        = new Mock <IPercentileSelector>();
            mockBooleanPercentileSelector = new Mock <IBooleanPercentileSelector>();
            mockCollectionsSelector       = new Mock <ICollectionsSelector>();

            curseGenerator = new CurseGenerator(mockDice.Object, mockPercentileSelector.Object, mockBooleanPercentileSelector.Object,
                                                mockCollectionsSelector.Object);

            itemVerifier = new ItemVerifier();
        }
Ejemplo n.º 19
0
        public void Setup()
        {
            mockInnerGenerator = new Mock <MagicalItemGenerator>();
            mockCurseGenerator = new Mock <ICurseGenerator>();
            decorator          = new MagicalItemGeneratorCurseDecorator(mockInnerGenerator.Object, mockCurseGenerator.Object);
            innerItem          = new Item();
            itemVerifier       = new ItemVerifier();

            innerItem.ItemType = "item type";
            innerItem.Name     = "item name";

            mockInnerGenerator.Setup(g => g.GenerateRandom("power")).Returns(innerItem);
        }
        private Item GetRandomTemplate(string name)
        {
            var template = ItemVerifier.CreateRandomTemplate(name);

            var abilitiesCount = Random.Next(specialAbilities.Count()) + 1;
            var abilityNames   = specialAbilities.Take(abilitiesCount);

            template.Magic.SpecialAbilities = abilityNames.Select(n => new SpecialAbility {
                Name = n
            });

            return(template);
        }
Ejemplo n.º 21
0
        public void Setup()
        {
            mockPercentileSelector        = new Mock <IPercentileSelector>();
            mockAmmunitionGenerator       = new Mock <IAmmunitionGenerator>();
            mockCollectionsSelector       = new Mock <ICollectionsSelector>();
            mockBooleanPercentileSelector = new Mock <IBooleanPercentileSelector>();
            mockDice = new Mock <Dice>();
            mundaneWeaponGenerator = new MundaneWeaponGenerator(mockPercentileSelector.Object, mockAmmunitionGenerator.Object, mockCollectionsSelector.Object, mockBooleanPercentileSelector.Object, mockDice.Object);
            itemVerifier           = new ItemVerifier();

            mockPercentileSelector.Setup(p => p.SelectFrom(TableNameConstants.Percentiles.Set.MundaneWeapons)).Returns("weapon type");
            expectedTableName = string.Format(TableNameConstants.Percentiles.Formattable.WEAPONTYPEWeapons, "weapon type");
            mockPercentileSelector.Setup(p => p.SelectFrom(expectedTableName)).Returns("weapon name");
        }
        public void Setup()
        {
            mockPercentileSelector  = new Mock <ITreasurePercentileSelector>();
            mockCollectionsSelector = new Mock <ICollectionSelector>();
            mockArmorDataSelector   = new Mock <IArmorDataSelector>();
            mundaneArmorGenerator   = new MundaneArmorGenerator(mockPercentileSelector.Object, mockCollectionsSelector.Object, mockArmorDataSelector.Object);
            itemVerifier            = new ItemVerifier();
            armorSelection          = new ArmorSelection();

            mockPercentileSelector.Setup(s => s.SelectFrom(TableNameConstants.Percentiles.Set.MundaneArmors)).Returns("armor type");
            mockArmorDataSelector.Setup(s => s.Select("armor type")).Returns(armorSelection);

            mockPercentileSelector.Setup(p => p.SelectFrom(TableNameConstants.Percentiles.Set.MundaneGearSizes)).Returns("size");
        }
        protected void GenerateAndAssertCustomItem()
        {
            var name            = GetRandomName();
            var template        = GetRandomTemplate(name);
            var allowDecoration = Convert.ToBoolean(Random.Next(2));

            var item = magicalItemGenerator.Generate(template, allowDecoration);

            AssertItem(item);
            Assert.That(item.ItemType, Is.EqualTo(itemType));

            if (!allowDecoration)
            {
                ItemVerifier.AssertMagicalItemFromTemplate(item, template);
            }
        }
Ejemplo n.º 24
0
        public void Setup()
        {
            mockTypeAndAmountPercentileSelector = new Mock <ITypeAndAmountPercentileSelector>();
            mockPercentileSelector = new Mock <IPercentileSelector>();
            itemVerifier           = new ItemVerifier();
            potionGenerator        = new PotionGenerator(mockTypeAndAmountPercentileSelector.Object, mockPercentileSelector.Object);

            var result = new TypeAndAmountPercentileResult();

            result.Amount = 9266;
            result.Type   = "potion";
            power         = "power";

            var tableName = string.Format(TableNameConstants.Percentiles.Formattable.POWERITEMTYPEs, power, ItemTypeConstants.Potion);

            mockTypeAndAmountPercentileSelector.Setup(s => s.SelectFrom(tableName)).Returns(result);
        }
Ejemplo n.º 25
0
        public void Setup()
        {
            mockPercentileSelector        = new Mock <IPercentileSelector>();
            mockCollectionsSelector       = new Mock <ICollectionsSelector>();
            mockSpecialAbilitiesGenerator = new Mock <ISpecialAbilitiesGenerator>();
            mockSpecificGearGenerator     = new Mock <ISpecificGearGenerator>();
            mockAmmunitionGenerator       = new Mock <IAmmunitionGenerator>();
            mockBooleanPercentileSelector = new Mock <IBooleanPercentileSelector>();
            mockSpellGenerator            = new Mock <ISpellGenerator>();
            mockDice        = new Mock <Dice>();
            weaponGenerator = new MagicalWeaponGenerator(mockCollectionsSelector.Object, mockPercentileSelector.Object, mockAmmunitionGenerator.Object, mockSpecialAbilitiesGenerator.Object, mockSpecificGearGenerator.Object, mockBooleanPercentileSelector.Object, mockSpellGenerator.Object, mockDice.Object);
            itemVerifier    = new ItemVerifier();

            power = "power";
            mockPercentileSelector.Setup(s => s.SelectFrom(TableNameConstants.Percentiles.Set.WeaponTypes)).Returns("weapon type");
            tableName = string.Format(TableNameConstants.Percentiles.Formattable.WEAPONTYPEWeapons, "weapon type");
            mockPercentileSelector.Setup(s => s.SelectFrom(tableName)).Returns("weapon name");
        }
        private Item GetRandomTemplate(string name)
        {
            var template = ItemVerifier.CreateRandomTemplate(name);

            var abilitiesCount = Random.Next(10) + 1;
            var abilityNames   = new HashSet <string>();

            while (abilityNames.Count < abilitiesCount)
            {
                var abilityName = GetRandom(specialAbilities);
                abilityNames.Add(abilityName);
            }

            template.Magic.SpecialAbilities = abilityNames.Select(n => new SpecialAbility {
                Name = n
            });

            return(template);
        }
Ejemplo n.º 27
0
        public void Setup()
        {
            mockTypeAndAmountPercentileSelector = new Mock <ITypeAndAmountPercentileSelector>();
            mockCollectionsSelector             = new Mock <ICollectionsSelector>();
            mockChargesGenerator = new Mock <IChargesGenerator>();
            result = new TypeAndAmountPercentileResult();
            mockBooleanPercentileSelector = new Mock <IBooleanPercentileSelector>();
            mockSpecialAbilitiesGenerator = new Mock <ISpecialAbilitiesGenerator>();
            rodGenerator = new RodGenerator(mockTypeAndAmountPercentileSelector.Object, mockCollectionsSelector.Object,
                                            mockChargesGenerator.Object, mockBooleanPercentileSelector.Object, mockSpecialAbilitiesGenerator.Object);
            itemVerifier = new ItemVerifier();

            result.Type   = "rod of ability";
            result.Amount = 9266;
            power         = "power";

            var tableName = string.Format(TableNameConstants.Percentiles.Formattable.POWERITEMTYPEs, power, ItemTypeConstants.Rod);

            mockTypeAndAmountPercentileSelector.Setup(s => s.SelectFrom(tableName)).Returns(result);
        }
        public void Setup()
        {
            mockTraitsGenerator    = new Mock <IMagicalItemTraitsGenerator>();
            mockAttributesSelector = new Mock <ICollectionsSelector>();
            mockChargesGenerator   = new Mock <IChargesGenerator>();
            mockSpellGenerator     = new Mock <ISpellGenerator>();
            mockPercentileSelector = new Mock <IPercentileSelector>();
            mockDice = new Mock <Dice>();
            mockTypeAndAmountPercentileSelector = new Mock <ITypeAndAmountPercentileSelector>();
            result = new TypeAndAmountPercentileResult();
            wondrousItemGenerator = new WondrousItemGenerator(mockPercentileSelector.Object, mockAttributesSelector.Object, mockChargesGenerator.Object, mockDice.Object, mockSpellGenerator.Object, mockTypeAndAmountPercentileSelector.Object);
            itemVerifier          = new ItemVerifier();

            power         = "power";
            result.Type   = "wondrous item";
            result.Amount = 0;
            var tableName = string.Format(TableNameConstants.Percentiles.Formattable.POWERITEMTYPEs, power, ItemTypeConstants.WondrousItem);

            mockTypeAndAmountPercentileSelector.Setup(p => p.SelectFrom(tableName)).Returns(result);
        }
        public void Setup()
        {
            mockPercentileSelector        = new Mock <ITreasurePercentileSelector>();
            mockCollectionsSelector       = new Mock <ICollectionSelector>();
            mockSpecialAbilitiesGenerator = new Mock <ISpecialAbilitiesGenerator>();
            mockSpecificGearGenerator     = new Mock <ISpecificGearGenerator>();
            mockMundaneArmorGenerator     = new Mock <MundaneItemGenerator>();
            mockJustInTimeFactory         = new Mock <JustInTimeFactory>();

            mockJustInTimeFactory.Setup(f => f.Build <MundaneItemGenerator>(ItemTypeConstants.Armor)).Returns(mockMundaneArmorGenerator.Object);

            magicalArmorGenerator = new MagicalArmorGenerator(
                mockPercentileSelector.Object,
                mockCollectionsSelector.Object,
                mockSpecialAbilitiesGenerator.Object,
                mockSpecificGearGenerator.Object,
                mockJustInTimeFactory.Object);

            itemVerifier = new ItemVerifier();
        }
Ejemplo n.º 30
0
        public void Setup()
        {
            mockPercentileSelector              = new Mock <IPercentileSelector>();
            mockCollectionsSelector             = new Mock <ICollectionsSelector>();
            mockSpecialAbilitiesGenerator       = new Mock <ISpecialAbilitiesGenerator>();
            mockMagicItemTraitsGenerator        = new Mock <IMagicalItemTraitsGenerator>();
            mockSpecificGearGenerator           = new Mock <ISpecificGearGenerator>();
            mockTypeAndAmountPercentileSelector = new Mock <ITypeAndAmountPercentileSelector>();
            magicalArmorGenerator = new MagicalArmorGenerator(mockTypeAndAmountPercentileSelector.Object, mockPercentileSelector.Object, mockCollectionsSelector.Object, mockSpecialAbilitiesGenerator.Object, mockSpecificGearGenerator.Object);

            itemVerifier = new ItemVerifier();

            result        = new TypeAndAmountPercentileResult();
            result.Type   = "armor type";
            result.Amount = 9266;
            power         = "power";

            var tableName = string.Format(TableNameConstants.Percentiles.Formattable.POWERITEMTYPEs, power, ItemTypeConstants.Armor);

            mockTypeAndAmountPercentileSelector.Setup(p => p.SelectFrom(tableName)).Returns(result);
        }