/// <summary> /// Constructor from another Open Close Time object /// </summary> /// <param name="other">The other Open Close Time to create the new Open Close Time from</param> public OpenCloseTime(OpenCloseTime other) { DayOfWeek = other.DayOfWeek; Hour = other.Hour; Minute = other.Minute; Closed = other.Closed; }
public void HasAlreadyHappened_EventInAnHour_ReturnsFalse() { DateTime before = DateTime.Now.AddHours(1); var target = new OpenCloseTime((int)before.DayOfWeek + 1, before.Hour, before.Minute, 0); DateTime date = DateTime.Now; Assert.IsFalse(target.HasAlreadyHappened(date)); }
public void HasAlreadyHappened_EventBefore_ReturnsTrue() { DateTime before = DateTime.Now.AddHours(-1); OpenCloseTime target = new OpenCloseTime((int)before.DayOfWeek +1 , before.Hour, before.Minute, 0); DateTime date = DateTime.Now; Assert.IsTrue(target.HasAlreadyHappened(date)); }
public void Test5AssignOpenCloseTimeClosed() { Console.WriteLine("Test5AssignOpenCloseTimeClosed"); OpenCloseTime testOpenCloseTime = new OpenCloseTime(); testOpenCloseTime.Closed = 0; Assert.AreEqual(testOpenCloseTime.Closed, 0); }
public void Test4AssignOpenCloseTimeMinute() { Console.WriteLine("Test4AssignOpenCloseTimeMinute"); OpenCloseTime testOpenCloseTime = new OpenCloseTime(); testOpenCloseTime.Minute = 35; Assert.AreEqual(testOpenCloseTime.Minute, 35); }
public void Test3AssignOpenCloseTimeHour() { Console.WriteLine("Test3AssignOpenCloseTimeHour"); OpenCloseTime testOpenCloseTime = new OpenCloseTime(); testOpenCloseTime.Hour = 15; Assert.AreEqual(testOpenCloseTime.Hour, 15); }
public void Test2AssignOpenCloseTimeDayOfWeek() { Console.WriteLine("Test2AssignOpenCloseTimeDayOfWeek"); OpenCloseTime testOpenCloseTime = new OpenCloseTime(); testOpenCloseTime.DayOfWeek = (int) DayOfWeek.Monday; Assert.AreEqual(testOpenCloseTime.DayOfWeek, (int) DayOfWeek.Monday); }
public void Test1CreateOpenCloseTimeClassTest() { Console.WriteLine("Test1CreateOpenCloseTimeClassTest"); OpenCloseTime testOpenCloseTime = new OpenCloseTime(); Assert.IsNotNull(testOpenCloseTime, "OpenCloseTime object created."); }
public void OpenCloseTimeConstructorTest() { var target = new OpenCloseTime(); int dayOfWeek = 1; int hour = 1; int minute = 1; int closed = 1; target = new OpenCloseTime(dayOfWeek, hour, minute, closed); Assert.AreEqual(dayOfWeek, target.DayOfWeek); }
public void OpenCloseTimeConstructor_CopyOther_ReturnsSameObject() { int dayOfWeek = 1; int hour = 1; int minute = 1; int closed = 1; var other = new OpenCloseTime(dayOfWeek, hour, minute, closed); OpenCloseTime target = new OpenCloseTime(other); Assert.AreEqual(other.DayOfWeek, target.DayOfWeek); }
public void Test6CreateOpenCloseTimeFromOpenCloseTime() { Console.WriteLine("Test6CreateOpenCloseTimeFromOpenCloseTime"); OpenCloseTime testOpenCloseTime1 = new OpenCloseTime(7, 5, 59, 1); OpenCloseTime testOpenCloseTime2 = new OpenCloseTime(testOpenCloseTime1); Assert.AreEqual(testOpenCloseTime2.DayOfWeek, 7); Assert.AreEqual(testOpenCloseTime2.Hour, 5); Assert.AreEqual(testOpenCloseTime2.Minute, 59); Assert.AreEqual(testOpenCloseTime2.Closed, 1); }
public void Test5CreateOpenCloseTimeWithInitialValues() { Console.WriteLine("Test5CreateOpenCloseTimeWithInitialValues"); OpenCloseTime testOpenCloseTime = new OpenCloseTime(1, 15, 35, 0); Assert.AreEqual(testOpenCloseTime.DayOfWeek, 1); Assert.AreEqual(testOpenCloseTime.Hour, 15); Assert.AreEqual(testOpenCloseTime.Minute, 35); Assert.AreEqual(testOpenCloseTime.Closed, 0); }
/// <summary> /// Method to Add Open Close Time to the sites list of open close times /// </summary> /// <param name="dayOfWeek">Day of the Week</param> /// <param name="hour">Hour</param> /// <param name="minute">Minute</param> /// <param name="closed">Whether close or not</param> public void AddOpenCloseTime(int dayOfWeek, int hour, int minute, int closed) { var openCloseTime = new OpenCloseTime(dayOfWeek, hour, minute, closed); OpenCloseTimes.Add(openCloseTime); }