public EncounterGenerator(ITypeAndAmountPercentileSelector typeAndAmountPercentileSelector, IRollSelector rollSelector, IPercentileSelector percentileSelector, ICollectionSelector collectionSelector, Dice dice, IEncounterCharacterGenerator encounterCharacterGenerator, IEncounterTreasureGenerator encounterTreasureGenerator, IFilterVerifier filterVerifier, IEncounterCollectionSelector creatureCollectionSelector) { this.typeAndAmountPercentileSelector = typeAndAmountPercentileSelector; this.rollSelector = rollSelector; this.percentileSelector = percentileSelector; this.collectionSelector = collectionSelector; this.dice = dice; this.encounterTreasureGenerator = encounterTreasureGenerator; this.encounterCharacterGenerator = encounterCharacterGenerator; this.filterVerifier = filterVerifier; this.creatureCollectionSelector = creatureCollectionSelector; challengeRatingRegex = new Regex(RegexConstants.ChallengeRatingPattern); subTypeRegex = new Regex(RegexConstants.DescriptionPattern); }
public void Setup() { mockCoinGenerator = new Mock<ICoinGenerator>(); mockGoodsGenerator = new Mock<IGoodsGenerator>(); mockItemsGenerator = new Mock<IItemsGenerator>(); mockAdjustmentSelector = new Mock<IAdjustmentSelector>(); mockBooleanPercentileSelector = new Mock<IBooleanPercentileSelector>(); mockCollectionSelector = new Mock<ICollectionSelector>(); mockMagicalItemGeneratorFactory = new Mock<IMagicalItemGeneratorRuntimeFactory>(); mockMundaneItemGeneratorFactory = new Mock<IMundaneItemGeneratorRuntimeFactory>(); encounterTreasureGenerator = new EncounterTreasureGenerator(mockCoinGenerator.Object, mockGoodsGenerator.Object, mockItemsGenerator.Object, mockAdjustmentSelector.Object, mockBooleanPercentileSelector.Object, mockCollectionSelector.Object, mockMagicalItemGeneratorFactory.Object, mockMundaneItemGeneratorFactory.Object); creature = new Creature(); usesSubtypeForTreasure = new List<string>(); level = 9266; creature.Name = "creature"; creature.Description = "subtype"; creature.Quantity = 1; coinMultiplier = 1; goodsMultiplier = 1; itemsMultiplier = 1; goods = new List<Good>() { new Good(), new Good() }; items = new List<Item>() { new Item(), new Item() }; coin = new Coin { Currency = "currency", Quantity = 600 }; mockBooleanPercentileSelector.Setup(s => s.SelectFrom(It.IsAny<double>())).Returns((double d) => d > 0); mockAdjustmentSelector.Setup(s => s.Select<double>(TableNameConstants.TreasureAdjustments, creature.Name, TreasureConstants.Coin)).Returns(() => coinMultiplier); mockAdjustmentSelector.Setup(s => s.Select<double>(TableNameConstants.TreasureAdjustments, creature.Name, TreasureConstants.Goods)).Returns(() => goodsMultiplier); mockAdjustmentSelector.Setup(s => s.Select<double>(TableNameConstants.TreasureAdjustments, creature.Name, TreasureConstants.Items)).Returns(() => itemsMultiplier); mockCoinGenerator.Setup(g => g.GenerateAtLevel(level)).Returns(coin); mockGoodsGenerator.Setup(g => g.GenerateAtLevel(level)).Returns(goods); mockItemsGenerator.Setup(g => g.GenerateAtLevel(level)).Returns(items); mockCollectionSelector.Setup(s => s.SelectFrom(TableNameConstants.CreatureGroups, GroupConstants.UseSubtypeForTreasure)).Returns(usesSubtypeForTreasure); }