Exemple #1
0
        public string ResolveSection(string equation)
        {
            var equationList = _equationPartsIdentifier.FindParts(equation);

            equationList = _mathsRuleResolvers.Aggregate(equationList, ResolveGeneric);

            return(equationList.First());
        }
Exemple #2
0
        public void BothPositiveResolution_PerformedCorrectly()
        {
            var equation = "1+1";
            var input    = new List <string>()
            {
                "1",
                "+",
                "1"
            };

            A.CallTo(() => _mathsRuleResolver.Operator).Returns("+");
            A.CallTo(() => _mathsRuleResolver.BothPositiveResolution(input, 1)).Returns("2");
            A.CallTo(() => _equationPartsIdentifier.FindParts(equation)).Returns(input);

            var response = _mathsResolver.ResolveSection(equation);

            response.Should().Be("+2");
            A.CallTo(() => _equationPartsIdentifier.FindParts(equation)).MustHaveHappened();
            A.CallTo(() => _mathsRuleResolver.BothPositiveResolution(input, 1)).MustHaveHappened();
        }