public void MultiplyCalculate() { var calculation = new CalculationMultiply(); calculation.AddValue("10"); calculation.AddValue("18"); calculation.calculate(); Assert.That(calculation.Answer, Is.EqualTo("180")); }
public void ListOfCalculations() { var calculationAdd1 = new CalculationAdd(); calculationAdd1.AddValue("12"); calculationAdd1.AddValue("18"); var calculationAdd2 = new CalculationAdd(); calculationAdd2.AddValue("23"); calculationAdd2.AddValue("17"); var calculationMultiply1 = new CalculationMultiply(); calculationMultiply1.AddValue("10"); calculationMultiply1.AddValue("18"); var calculationMultiply2 = new CalculationMultiply(); calculationMultiply2.AddValue("5"); calculationMultiply2.AddValue("8"); List<Calculation> ListCalc = new List<Calculation>(); ListCalc.Add(calculationAdd1); ListCalc.Add(calculationAdd2); ListCalc.Add(calculationMultiply1); ListCalc.Add(calculationMultiply2); ListCalc.ForEach(Calculation => Calculation.calculate()); Assert.That(calculationAdd1.Answer, Is.EqualTo("30")); Assert.That(calculationAdd2.Answer, Is.EqualTo("40")); Assert.That(calculationMultiply1.Answer, Is.EqualTo("180")); Assert.That(calculationMultiply2.Answer, Is.EqualTo("40")); }