コード例 #1
0
ファイル: FilterVerifier.cs プロジェクト: DnDGen/EncounterGen
        public FilterVerifier(ITypeAndAmountPercentileSelector typeAndAmountPercentileSelector, ICollectionSelector collectionSelector, IEncounterCollectionSelector encounterCollectionSelector, IRollSelector rollSelector)
        {
            this.typeAndAmountPercentileSelector = typeAndAmountPercentileSelector;
            this.collectionSelector = collectionSelector;
            this.encounterCollectionSelector = encounterCollectionSelector;
            this.rollSelector = rollSelector;

            challengeRatingRegex = new Regex(RegexConstants.ChallengeRatingPattern);
            descriptionRegex = new Regex(RegexConstants.DescriptionPattern);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        public void Setup()
        {
            mockCollectionSelector = new Mock<ICollectionSelector>();
            creatureCollectionSelector = new EncounterCollectionSelector(mockCollectionSelector.Object);

            levelEncounters = new List<string>();
            environmentEncounters = new List<string>();
            temperatureEncounters = new List<string>();
            timeOfDayEncounters = new List<string>();
            magicEncounters = new List<string>();
            specificEncounters = new List<string>();
            landEncounters = new List<string>();
            dragonEncounters = new List<string>();

            environmentEncounters.Add("encounter/amount");
            environmentEncounters.Add("environment encounter/environment amount");
            temperatureEncounters.Add("temperature encounter/temperature amount");
            magicEncounters.Add("magic encounter/amount");
            landEncounters.Add("land encounter/amount");
            dragonEncounters.Add("dragon encounter/amount");

            levelEncounters.Add("encounter/amount");
            levelEncounters.Add("encounter/level amount");
            timeOfDayEncounters.Add("encounter/amount");
            timeOfDayEncounters.Add("time of day encounter/amount");

            mockCollectionSelector.Setup(s => s.SelectFrom(TableNameConstants.EncounterGroups, level.ToString())).Returns(levelEncounters);
            mockCollectionSelector.Setup(s => s.SelectFrom(TableNameConstants.EncounterGroups, environment)).Returns(environmentEncounters);
            mockCollectionSelector.Setup(s => s.SelectFrom(TableNameConstants.EncounterGroups, temperature)).Returns(temperatureEncounters);
            mockCollectionSelector.Setup(s => s.SelectFrom(TableNameConstants.EncounterGroups, timeOfDay)).Returns(timeOfDayEncounters);
            mockCollectionSelector.Setup(s => s.SelectFrom(TableNameConstants.EncounterGroups, GroupConstants.Magic)).Returns(magicEncounters);
            mockCollectionSelector.Setup(s => s.SelectFrom(TableNameConstants.EncounterGroups, string.Empty)).Returns(Enumerable.Empty<string>());
            mockCollectionSelector.Setup(s => s.SelectFrom(TableNameConstants.EncounterGroups, temperature + environment)).Returns(specificEncounters);
            mockCollectionSelector.Setup(s => s.SelectFrom(TableNameConstants.EncounterGroups, GroupConstants.Land)).Returns(landEncounters);
            mockCollectionSelector.Setup(s => s.SelectFrom(TableNameConstants.EncounterGroups, GroupConstants.Dragon)).Returns(dragonEncounters);

            mockCollectionSelector.Setup(s => s.SelectRandomFrom(It.IsAny<IEnumerable<string>>())).Returns((IEnumerable<string> collection) => collection.Last());
        }