public void Setup() { mockDice = new Mock <Dice>(); mockTypeAndAmountPercentileSelector = new Mock <ITypeAndAmountPercentileSelector>(); mockAttributesSelector = new Mock <ICollectionsSelector>(); generator = new GoodsGenerator(mockDice.Object, mockTypeAndAmountPercentileSelector.Object, mockAttributesSelector.Object); typeAndAmountResult = new TypeAndAmountPercentileResult(); valueResult = new TypeAndAmountPercentileResult(); typeAndAmountResult.Type = "type"; typeAndAmountResult.Amount = 2; valueResult.Type = "first value"; valueResult.Amount = 9266; mockTypeAndAmountPercentileSelector.Setup(p => p.SelectFrom(It.IsAny <string>())).Returns(typeAndAmountResult); var tableName = string.Format(TableNameConstants.Percentiles.Formattable.GOODTYPEValues, typeAndAmountResult.Type); mockTypeAndAmountPercentileSelector.Setup(p => p.SelectFrom(tableName)).Returns(valueResult); var descriptions = new[] { "description 1", "description 2" }; tableName = string.Format(TableNameConstants.Collections.Formattable.GOODTYPEDescriptions, typeAndAmountResult.Type); mockAttributesSelector.Setup(p => p.SelectFrom(tableName, It.IsAny <string>())).Returns(descriptions); mockDice.Setup(d => d.Roll(1).d(2).AsSum()).Returns(2); }
public EncounterTreasureGenerator(ICoinGenerator coinGenerator, IGoodsGenerator goodsGenerator, IItemsGenerator itemsGenerator, IAdjustmentSelector adjustmentSelector, IBooleanPercentileSelector booleanPercentileSelector, ICollectionSelector collectionSelector, IMagicalItemGeneratorRuntimeFactory magicalItemGeneratorRuntimeFactory, IMundaneItemGeneratorRuntimeFactory mundaneItemGeneratorRuntimeFactory) { this.coinGenerator = coinGenerator; this.goodsGenerator = goodsGenerator; this.itemsGenerator = itemsGenerator; this.adjustmentSelector = adjustmentSelector; this.booleanPercentileSelector = booleanPercentileSelector; this.collectionSelector = collectionSelector; this.magicalItemGeneratorRuntimeFactory = magicalItemGeneratorRuntimeFactory; this.mundaneItemGeneratorRuntimeFactory = mundaneItemGeneratorRuntimeFactory; subTypeRegex = new Regex(RegexConstants.DescriptionPattern); itemTypeRegex = new Regex(RegexConstants.ItemTypePattern); itemBonusRegex = new Regex(RegexConstants.ItemBonusPattern); specialAbilityRegex = new Regex(RegexConstants.SpecialAbilitiesPattern); traitRegex = new Regex(RegexConstants.TraitPattern); }
public void Setup() { mockTypeAndAmountPercentileSelector = new Mock <ITypeAndAmountPercentileSelector>(); mockCollectionsSelector = new Mock <ICollectionSelector>(); generator = new GoodsGenerator(mockTypeAndAmountPercentileSelector.Object, mockCollectionsSelector.Object); selection = new TypeAndAmountSelection(); valueSelection = new TypeAndAmountSelection(); selection.Type = "type"; selection.Amount = 2; valueSelection.Type = "first value"; valueSelection.Amount = 9266; mockTypeAndAmountPercentileSelector.Setup(p => p.SelectFrom(It.IsAny <string>())).Returns(selection); var tableName = string.Format(TableNameConstants.Percentiles.Formattable.GOODTYPEValues, selection.Type); mockTypeAndAmountPercentileSelector.Setup(p => p.SelectFrom(tableName)).Returns(valueSelection); descriptions = new List <string> { "description 1", "description 2" }; tableName = string.Format(TableNameConstants.Collections.Formattable.GOODTYPEDescriptions, selection.Type); var count = 0; object testLock = new object(); mockCollectionsSelector .Setup(p => p.SelectRandomFrom(tableName, It.IsAny <string>())) .Returns(() => { lock (testLock) { return(descriptions[count++ % descriptions.Count]); } }); }
public TreasureGenerator(ICoinGenerator coinFactory, IGoodsGenerator goodsFactory, IItemsGenerator itemsFactory) { this.coinFactory = coinFactory; this.goodsFactory = goodsFactory; this.itemsFactory = itemsFactory; }
public GoodsGeneratorEventGenDecorator(IGoodsGenerator innerGenerator, GenEventQueue eventQueue) { this.eventQueue = eventQueue; this.innerGenerator = innerGenerator; }
public void Setup() { goodsGenerator = GetNewInstanceOf <IGoodsGenerator>(); }
public void Setup() { mockInnerGenerator = new Mock <IGoodsGenerator>(); mockEventQueue = new Mock <GenEventQueue>(); decorator = new GoodsGeneratorEventGenDecorator(mockInnerGenerator.Object, mockEventQueue.Object); }