public void SetupTimersElseStatement_Test() { DateTime date = new DateTime(2019, 5, 19, 20, 50, 0); Flight flight = new Flight(date, "BABY98", 3, 1); flight.BaggageDispatched = 4; List <Flight> flights = new List <Flight>(); flights.Add(flight); Procp_Form.Core.CheckInDispatcher checkInDispatcher = new Procp_Form.Core.CheckInDispatcher(); checkInDispatcher.SetupTimers(flights); bool isStopped = false; foreach (Timer t in checkInDispatcher.timers) { if (t.Enabled == false) { isStopped = true; } } Assert.IsTrue(isStopped); }
//[TestMethod] //public void CalculateDispatchRate_Test() //{ // DateTime date = new DateTime(2019, 5,14,20, 44, 0 ); // Flight flight = new Flight(date, "BABY98", 3, 1); // Procp_Form.Core.CheckInDispatcher checkInDispatcher = new Procp_Form.Core.CheckInDispatcher(); // double a = checkInDispatcher.CalculateDispatchRate(flight); // //works if and only if you set the date to half an hour after the current time, // //so if for an example the time right now is 12, the date should be set to 12:30. // Assert.AreEqual(600000, a); //} //WARNING! IN ORDER FOR THIS TEST TO WORK YOU SHOULD CHANGE THE DATE TO MORE THAN THE CURRENT TIME //[TestMethod] public void SetupTimersIfStatement_Test() { DateTime date = new DateTime(2019, 5, 19, 20, 20, 0); Flight flight = new Flight(date, "BABY98", 3, 1); flight.BaggageDispatched = 1; List <Flight> flights = new List <Flight>(); flights.Add(flight); Procp_Form.Core.CheckInDispatcher checkInDispatcher = new Procp_Form.Core.CheckInDispatcher(); checkInDispatcher.SetupTimers(flights); Assert.AreEqual(1, checkInDispatcher.timers.Count); Assert.AreEqual(1, flight.BaggageDispatched); }