public void SetUp() { validCommandCollection = MockCommandGenerator.GenerateValidCommandCollection().ToList(); commandRepositoryMock = Substitute.For <ICommandRepositoryService>(); commandPathCalculatorMock = Substitute.For <ICommandPathCalculator>(); commandContextMock = Substitute.For <ICommandContext>(); commandContextFactoryMock = Substitute.For <Func <ICommandContext> >(); commandContextFactoryMock().Returns(commandContextMock); commandHistoryServiceMock = Substitute.For <ICommandHistoryService>(); systemUnderTest = new CommandLineProcessorProvider( commandRepositoryMock, commandPathCalculatorMock, commandContextFactoryMock, commandHistoryServiceMock); }
public CommandLineProcessorProvider( ICommandRepositoryService commandRepository, ICommandPathCalculator commandPathCalculator, Func <ICommandContext> contextFactory, ICommandHistoryService historyService) { this.commandRepository = commandRepository; this.commandPathCalculator = commandPathCalculator; this.contextFactory = contextFactory; HistoryService = historyService; stateStack = new Stack <CommandLineProcessorState>(); state = new CommandLineProcessorState { Status = CommandLineStatus.WaitingForCommandRegistration, Context = this.contextFactory() }; Settings = new CommandLineSettings(); }