public void IsEarlyBirdRateTest() { EntryDate = new DateTime(2010, 8, 18, 0, 0, 0).ToShortDateString(); ExitDate = new DateTime(2010, 8, 18, 0, 0, 0).ToShortDateString(); EntryTime = new DateTime(2010, 8, 18, 8, 0, 0).TimeOfDay.ToString(); ExitTime = new DateTime(2010, 8, 18, 20, 30, 0).TimeOfDay.ToString(); string result = cp.CalculateCost(EntryDate, EntryTime, ExitDate, ExitTime); Assert.AreEqual("Early Bird Rates", result.Split(':')[0]); }
public void NotWeekendRate_ExitAfterSunMidnight() { EntryDate = new DateTime(2019, 2, 2, 0, 0, 0).ToShortDateString(); ExitDate = new DateTime(2019, 2, 4, 0, 0, 0).ToShortDateString(); EntryTime = new DateTime(2019, 2, 2, 11, 0, 0).TimeOfDay.ToString(); ExitTime = new DateTime(2019, 2, 4, 1, 0, 0).TimeOfDay.ToString(); string result = cp.CalculateCost(EntryDate, EntryTime, ExitDate, ExitTime); Assert.AreNotEqual("Weekend Rates", result.Split(':')[0]); }
public void InvalidTime_EntryTimeHigherThanCurrentorExitTime() { EntryDate = currTime.ToShortDateString(); ExitDate = currTime.ToShortDateString(); EntryTime = currTime.AddHours(2.0).TimeOfDay.ToString(); ExitTime = currTime.TimeOfDay.ToString(); string result = cp.CalculateCost(EntryDate, EntryTime, ExitDate, ExitTime); Assert.AreEqual("Incorrect time entrered.", result); }
public void IsNightRate_SameNightLeave() { EntryDate = new DateTime(2010, 8, 18, 0, 0, 0).ToShortDateString(); ExitDate = new DateTime(2010, 8, 18, 0, 0, 0).ToShortDateString(); EntryTime = new DateTime(2010, 8, 18, 19, 0, 0).TimeOfDay.ToString(); ExitTime = new DateTime(2010, 8, 18, 23, 0, 0).TimeOfDay.ToString(); string result = cp.CalculateCost(EntryDate, EntryTime, ExitDate, ExitTime); Assert.AreEqual("Night Rates", result.Split(':')[0]); }
public void IsHourlyRate_0to1Hr() { EntryDate = new DateTime(2010, 8, 18, 0, 0, 0).ToShortDateString(); ExitDate = new DateTime(2010, 8, 18, 0, 0, 0).ToShortDateString(); EntryTime = new DateTime(2010, 8, 18, 15, 0, 0).TimeOfDay.ToString(); ExitTime = new DateTime(2010, 8, 18, 15, 45, 0).TimeOfDay.ToString(); string result = cp.CalculateCost(EntryDate, EntryTime, ExitDate, ExitTime); Assert.AreEqual("Hourly Rate: $5", result); }