public void Simplifier_Receives_From_ModelBuilder() { var tokenizer = Substitute.For <ITokenizer>(); var modelBuilderResult = new Constant(); mModelBuilder.BuildFrom(tokenizer.Tokens).Returns(modelBuilderResult); mUnderTest.Simplify(tokenizer); mSimplifier.Received().Simplify(modelBuilderResult); }
public void Evaluate_Passes_ModelBuilder_Result_To_ExpressionEvaluator() { var tokenizer = Substitute.For <ITokenizer>(); var modelBuilderResult = new Constant(); mModelBuilder.BuildFrom(tokenizer.Tokens).Returns(modelBuilderResult); mUnderTest.Evaluate(tokenizer, null); mExpressionEvaluator.Received().Evaluate(modelBuilderResult, null); }
public string Simplify(string input) { mTokenizer.Tokenize(input, null); var expressionTree = mModelBuilder.BuildFrom(mTokenizer.Tokens); var simplified = mSimplifier.Simplify(expressionTree); return(mFormatter.Format(simplified)); }
IExpression CreateInMemoryModel(ITokenizer token) => mModelBuilder.BuildFrom(token.Tokens);
public decimal Evaluate(ITokenizer token, IApplicationArguments args) { var expression = mModelBuilder.BuildFrom(token.Tokens); return(mExpressionEvaluator.Evaluate(expression, args)); }