public override void DoDemo() { Console.WriteLine("===================[Begin Demo: " + DemoTitle + "]====================="); TestFixture.SetUp(); TestFixture.RunTests(); TestFixture.TearDown(); var state = new CalculatorState(); var proc = new CalculatorProcessor(state); var disp = new List <CalculatorDisplay> { new CalculatorDisplay(), new CalculatorDisplay(), new CalculatorDisplay(), }; var calc = new Calculator(proc, disp.ToArray()); Console.WriteLine("Running calculator with " + disp.Count + " displays"); Console.WriteLine("Adding 10 ..."); calc.Add(10); Console.WriteLine("Substracting 5 ..."); calc.Substract(5); Console.WriteLine("===================[End Demo: " + DemoTitle + "]======================"); }
public Calculator(CalculatorProcessor processor, params CalculatorDisplay[] displays) { _processor = processor; foreach (var display in displays) { AddDisplay(display); } }
public override void RunTests() { var state = new CalculatorState(); var proc = new CalculatorProcessor(state); var calc = new Calculator(proc, _displays.Select(m => m.Object).ToArray()); calc.Add(10); calc.Substract(5); foreach (var disp in _displays) { disp.VerifyAll(); } }
public Calculator(CalculatorProcessor processor) { _processor = processor; }
public Calculator(CalculatorProcessor processor, CalculatorDisplay display) { _processor = processor; AddDisplay(display); }