Beispiel #1
0
        public IntelligenceSelection SelectFrom(string name)
        {
            var data = innerSelector.SelectFrom(TableNameConstants.Collections.Set.IntelligenceData, name).ToList();

            if (data.Count != 3)
            {
                throw new Exception("Data is not formatted for intelligence");
            }

            var result = new IntelligenceSelection();

            result.Senses             = data[DataIndexConstants.Intelligence.Senses];
            result.LesserPowersCount  = Convert.ToInt32(data[DataIndexConstants.Intelligence.LesserPowersCount]);
            result.GreaterPowersCount = Convert.ToInt32(data[DataIndexConstants.Intelligence.GreaterPowersCount]);

            return(result);
        }
        public void Setup()
        {
            mockDice = new Mock <Dice>();
            mockPercentileSelector       = new Mock <ITreasurePercentileSelector>();
            mockCollectionsSelector      = new Mock <ICollectionSelector>();
            mockIntelligenceDataSelector = new Mock <IIntelligenceDataSelector>();
            intelligenceSelection        = new IntelligenceSelection();
            attributes = new List <string>();
            item       = new Item();
            itemType   = "item type";

            var fillerValues = new[] { "0" };

            mockCollectionsSelector.Setup(s => s.SelectFrom(It.IsAny <string>(), It.IsAny <string>())).Returns(fillerValues);
            mockDice.Setup(d => d.Roll(1).d(4).AsSum <int>()).Returns(4);
            mockDice.Setup(d => d.Roll(1).d(3).AsSum <int>()).Returns(3);
            mockPercentileSelector.Setup(s => s.SelectFrom(TableNameConstants.Percentiles.Set.IntelligenceStrongStats)).Returns("10");
            mockIntelligenceDataSelector.Setup(s => s.SelectFrom(It.IsAny <string>())).Returns(intelligenceSelection);
            mockPercentileSelector.Setup(s => s.SelectFrom(TableNameConstants.Percentiles.Set.IntelligenceAlignments)).Returns(string.Empty);

            intelligenceGenerator = new IntelligenceGenerator(mockDice.Object, mockPercentileSelector.Object, mockCollectionsSelector.Object, mockIntelligenceDataSelector.Object);
        }