public void When_no_parameters_should_evaluate(string math, decimal result) { var language = new ArithmeticLanguage(); var function = language.Parse(math).Compile(); Assert.Equal(result, function(), 3); }
public void When_parameters_should_evaluate(string math, decimal result) { var language = new ArithmeticLanguage(); var function = language.Parse <Parameter>(math).Compile(); var parameter = new Parameter() { FavouriteNumber = 7, Limits = new Limit() { Min = -1.0, Max = 1.5 } }; Assert.Equal(result, function(parameter), 3); }