public void CalculateException() { List <IOperationInterface> interfaces = new List <IOperationInterface>(); OperationInterfaceMult mult = new OperationInterfaceMult(); OperationInterfaceDiv div = new OperationInterfaceDiv(); OperationInterfaceSum sum = new OperationInterfaceSum(); OperationInterfaceSub sub = new OperationInterfaceSub(); interfaces.Add(mult); interfaces.Add(div); interfaces.Add(sum); interfaces.Add(sub); var calculator = new Calculator(interfaces); var result = calculator.Calculate("1*2-9"); Check.That(result).IsEqualTo(Convert.ToDecimal(0.0)); }
public static void Main() { ConnecteurFichier operationsListe = new ConnecteurFichier(); List <IOperationInterface> interfaces = new List <IOperationInterface>(); OperationInterfaceMult mult = new OperationInterfaceMult(); OperationInterfaceDiv div = new OperationInterfaceDiv(); OperationInterfaceSum sum = new OperationInterfaceSum(); OperationInterfaceSub sub = new OperationInterfaceSub(); interfaces.Add(mult); interfaces.Add(div); interfaces.Add(sum); interfaces.Add(sub); var calculatorTrainer = new CalculatorTrainer(operationsListe); calculatorTrainer.Run(interfaces); }