public void TestNext_ReturnCorrect() { JourneyRepository repo = new JourneyRepository(new ListManagerJourney()); var startDate = new DateTime(2018, 01, 01); repo.Add(new Journey("test", "test", 0, 0, startDate, startDate.AddDays(7))); startDate = DateTime.Now; repo.Add(new Journey("test", "test", 0, 0, startDate, startDate.AddDays(7))); startDate = startDate.AddDays(6); var journey = new Journey("test", "test", 0, 0, startDate, startDate.AddDays(7)); repo.Add(journey); Assert.AreEqual(journey, repo.Next()); }
public void Run() { _running = true; while (_running) { Console.WriteLine("Vad vill du göra?"); Console.WriteLine("0 - Avsluta"); Console.WriteLine("1 - Lägga till en ny resa"); Console.WriteLine("2 - Anmäl en person till nästa resa"); Console.WriteLine("3 - Visa resa"); Console.WriteLine("4 - Visa alla resor"); var input = Console.ReadLine().ToLower(); if (input == "0" || input == "avsluta") { _running = false; } else { if (input == "1" || input == "lägga till resa") { Console.WriteLine("Lägga till resa"); } else if (input == "2" || input == "lägga till person") { SignPerson(); } else if (input == "3" || input == "nästa") { Print(Journeys.Next()); } else if (input == "4" || input == "lägga till person") { Journeys.GetAll().ToList().ForEach(Print); PressAnyKey(); } else { Console.WriteLine($"Okänt kommando: {input}"); } } } }