public void SearchAppLauncher_Start_ValidNumberOfArguments_CorrectSyntax_ShouldCallSearch() { var test = new SearchAppLauncher(_mockOrganisationRepository.Object, _mockTicketRepository.Object, _mockUserRepository.Object, _mockSearchMethod.Object); var args = new string[] { "-search", "test", "-dataset", "organisations" }; test.Start(args); _mockSearchMethod.Verify(m => m.Search(It.IsAny <string>(), It.IsAny <IEnumerable <Object> >()), Times.Once); }
public void SearchAppLauncher_Start_InvalidNumberOfArguments_MoreThanMaxArguments_ShouldNotCalLSearch() { var test = new SearchAppLauncher(_mockOrganisationRepository.Object, _mockTicketRepository.Object, _mockUserRepository.Object, _mockSearchMethod.Object); var args = new string[] { "-search", "nothing", "none", "test", "test2", "test3", "test4" }; test.Start(args); _mockSearchMethod.Verify(m => m.Search(It.IsAny <string>(), It.IsAny <IEnumerable <Object> >()), Times.Never); }
public void SearchAppLauncher_Start_ValidNumberOfArguments_WrongSyntax_NoSearchArgument_ShouldNotCalLSearch() { var test = new SearchAppLauncher(_mockOrganisationRepository.Object, _mockTicketRepository.Object, _mockUserRepository.Object, _mockSearchMethod.Object); var args = new string[] { "test", "nothing", "-dataset", "test", "test2" }; test.Start(args); _mockSearchMethod.Verify(m => m.Search(It.IsAny <string>(), It.IsAny <IEnumerable <Object> >()), Times.Never); }
static void Main(string[] args) { var dataService = new JsonToModelConverterService(); var searchMethod = new PropertyValueSearch(); var organisationRepository = new OrganisationRepository(dataService.GetModelsFromFile <Organisation>("organizations.json")); var ticketRepository = new TicketRepository(dataService.GetModelsFromFile <Ticket>("tickets.json")); var userRepository = new UserRepository(dataService.GetModelsFromFile <User>("users.json")); SearchAppLauncher app = new SearchAppLauncher(organisationRepository, ticketRepository, userRepository, searchMethod); app.Start(args); Console.Read(); }