public void Start_ShouldReadCommands() { var mockedCommandReader = new Mock <ICommandReader>(); mockedCommandReader.Setup(x => x.ReadCommands()).Returns(new List <ICommand>()); var mockedCommandProcessor = new Mock <ICommandProcessor>(); var mockedReportPrinter = new Mock <IReportPrinter>(); var mockedUserService = new Mock <IUserService>(); var engine = new DealershipEngine(mockedCommandReader.Object, mockedCommandProcessor.Object, mockedReportPrinter.Object, mockedUserService.Object); engine.Start(); mockedCommandReader.Verify(x => x.ReadCommands(), Times.Once); }
public void Start_ShouldCallCommandManagerProcessCommand_IfCalled() { var writerMock = new Mock <IWriter>(); var dataProviderMock = new Mock <IDataProvider>(); var commandManagerMock = new Mock <ICommandManager>(); var dealershipFactoryMock = new Mock <IDealershipFactory>(); var dealershipEngine = new DealershipEngine( writerMock.Object, dataProviderMock.Object, commandManagerMock.Object, dealershipFactoryMock.Object); dealershipEngine.Start(); commandManagerMock.Verify(x => x.ProcessCommands(It.IsAny <IEnumerable <ICommand> >()), Times.Once); }
public void Start_ShouldCallCommandManagerReadCommands_IfCalled() { var writerMock = new Mock <IWriter>(); var dataProviderMock = new Mock <IDataProvider>(); var commandManagerMock = new Mock <ICommandManager>(); var dealershipFactoryMock = new Mock <IDealershipFactory>(); var dealershipEngine = new DealershipEngine( writerMock.Object, dataProviderMock.Object, commandManagerMock.Object, dealershipFactoryMock.Object); dealershipEngine.Start(); commandManagerMock.Verify(x => x.ReadCommands(), Times.Once); }
public void Start_ShouldPrintReports() { var mockedCommandReader = new Mock <ICommandReader>(); var mockedCommand = new Mock <ICommand>(); mockedCommandReader.Setup(x => x.ReadCommands()).Returns(new List <ICommand>() { mockedCommand.Object }); var mockedCommandProcessor = new Mock <ICommandProcessor>(); mockedCommandProcessor.Setup(x => x.Process(mockedCommand.Object)).Returns("report"); var mockedReportPrinter = new Mock <IReportPrinter>(); mockedReportPrinter.Setup(x => x.PrintReports(It.IsAny <IEnumerable <string> >())); var mockedUserService = new Mock <IUserService>(); var engine = new DealershipEngine(mockedCommandReader.Object, mockedCommandProcessor.Object, mockedReportPrinter.Object, mockedUserService.Object); engine.Start(); mockedReportPrinter.Verify(x => x.PrintReports(It.Is <ICollection <string> >(t => t.Contains("report"))), Times.Once); }
public static void Main() { var engine = new DealershipEngine(); engine.Start(); }