public void Given_MachineDetail_when_PrintMachineNameCalled_ShouldReturnMachineName() { var printer = MockRepository.GenerateMock<IPrinter>(); printer.Stub(x => x.GenerateMchineNameFormat(null)).IgnoreArguments().Return("The Machine Name is TestMachine"); var machine = new Machine(printer); var machineDetail = new MachineDetail { Id = 1, Name = "TestMachine" }; machine.PrintMachineName(machineDetail); Assert.That(machine.Output, Is.EqualTo("The Machine Name is TestMachine")); }
public string GetFaxName(List<MachineDetail> details) { string allFaxMachineNameInFormat=string.Empty; foreach (var machineDetail in details) { _machine = new Machine(new Printer()); _machine.PrintMachineName(machineDetail); allFaxMachineNameInFormat += _machine.Output+"\n"; } return allFaxMachineNameInFormat; }