public IntelligenceAttributesResult SelectFrom(string tableName, string name)
        {
            var attributes = innerSelector.SelectFrom(tableName, name).ToList();

            if (attributes.Count < 3)
            {
                throw new Exception("Attributes are not formatted for intelligence");
            }

            var result = new IntelligenceAttributesResult();

            result.Senses             = attributes[0];
            result.LesserPowersCount  = Convert.ToInt32(attributes[1]);
            result.GreaterPowersCount = Convert.ToInt32(attributes[2]);

            return(result);
        }
Ejemplo n.º 2
0
        public void Setup()
        {
            mockDice = new Mock <Dice>();
            mockPercentileSelector             = new Mock <IPercentileSelector>();
            mockAttributesSelector             = new Mock <ICollectionsSelector>();
            mockIntelligenceAttributesSelector = new Mock <IIntelligenceAttributesSelector>();
            mockBooleanPercentileSelector      = new Mock <IBooleanPercentileSelector>();
            intelligenceAttributesResult       = new IntelligenceAttributesResult();
            attributes = new List <string>();
            item       = new Item();
            itemType   = "item type";

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

            mockAttributesSelector.Setup(s => s.SelectFrom(It.IsAny <string>(), It.IsAny <string>())).Returns(fillerValues);
            mockDice.Setup(d => d.Roll(1).d(4).AsSum()).Returns(4);
            mockPercentileSelector.Setup(s => s.SelectFrom(TableNameConstants.Percentiles.Set.IntelligenceStrongStats)).Returns("10");
            mockIntelligenceAttributesSelector.Setup(s => s.SelectFrom(TableNameConstants.Collections.Set.IntelligenceAttributes, It.IsAny <string>())).Returns(intelligenceAttributesResult);
            mockPercentileSelector.Setup(s => s.SelectFrom(TableNameConstants.Percentiles.Set.IntelligenceAlignments)).Returns(string.Empty);

            intelligenceGenerator = new IntelligenceGenerator(mockDice.Object, mockPercentileSelector.Object,
                                                              mockAttributesSelector.Object, mockIntelligenceAttributesSelector.Object, mockBooleanPercentileSelector.Object);
        }