public void Run(string[] commandArguments) { if (!ValidateArguments(commandArguments)) { return; } var algorithmType = GetAlgorithmType(commandArguments[1]); using (StreamReader reader = new StreamReader(commandArguments[0])) { string line; while ((line = reader.ReadLine()) != null) { ticketList.AddRange(luckyTicketParser.CheckTicketsInLine(line)); } } switch (algorithmType) { case AlgorithmType.MoskowAlgirithm: luckyTicketAlgorithm = new MoskowAlgorithm(); logger.Info(StringConstants.MOSKOW_ALGORITHM_USED); break; case AlgorithmType.PiterAlgirithm: luckyTicketAlgorithm = new PiterAlgorithm(); logger.Info(StringConstants.PITER_ALGORITHM_USED); break; } UI.ConsoleOutPut(string.Format(StringConstants.OUTPUT_RESULT, luckyTicketAlgorithm.Algorithm(ticketList))); }
public void PiterAlgorithm_WithsArrayOfTickets_ShouldReturnTrue(string[] ticketsArray, int expected) { List <Ticket> ticketList = new List <Ticket>(); foreach (string ticket in ticketsArray) { ticketList.Add(new Ticket(ticket)); } Assert.Equal(expected, ticketAlgorithm.Algorithm(ticketList)); }