public void Generates_Correct_String_OperatorDivide_ActualResult() { var randomGen = new MockRandomGenerator(); var generator = new MathEquationGenerator(randomGen); randomGen.NextInts = new[] { 12, 2 }; randomGen.NextDoubles = new[] { 0.9d }; randomGen.NextBools = new[] { true }; var equation = generator.GenerateEquation(); Assert.Equal("12 / 2 = 6", equation.EquationString); Assert.Equal(6d, equation.ShownResult, 1); Assert.Single(equation.ActualResults); Assert.Equal(6d, equation.ActualResults.First(), 1); randomGen.NextInts = new[] { 10, 4 }; randomGen.NextDoubles = new[] { 0.9d }; randomGen.NextBools = new[] { true }; equation = generator.GenerateEquation(); Assert.EndsWith("10 / 4 = 2.5", equation.EquationString); Assert.Equal(2.5d, equation.ShownResult, 1); Assert.Single(equation.ActualResults); Assert.Equal(2.5d, equation.ActualResults.First(), 1); }
public void Generates_Correct_String_OperatorMultiply_ActualResult() { var randomGen = new MockRandomGenerator(); var generator = new MathEquationGenerator(randomGen); randomGen.NextInts = new[] { 5, 6 }; randomGen.NextDoubles = new[] { 0.6d }; randomGen.NextBools = new[] { true }; var equation = generator.GenerateEquation(); Assert.Equal("5 * 6 = 30", equation.EquationString); Assert.Equal(30d, equation.ShownResult, 1); Assert.Single(equation.ActualResults); Assert.Equal(30d, equation.ActualResults.First(), 1); }