public void It_Must_Raise_ArgumentOurOfRangeException_If_DueDate_Is_Constructed_Previous_To_StartDate() { DateTime sd = DateTime.Now; DateTime dd = sd.AddMilliseconds(-1); ActionScheduleInfo asi = new ActionScheduleInfo(sd, dd); }
public void It_Must_Raise_ArgumentOurOfRangeException_If_StartDate_Is_Set_Back_To_DueDate() { DateTime sd = DateTime.Now; DateTime dd = sd.AddDays(1); ActionScheduleInfo asi = new ActionScheduleInfo(sd, dd); asi.StartDate = asi.DueDate.Value.AddMilliseconds(1); }
private static ActionScheduleInfo CreateScheduleInfo(int seed) { ActionScheduleInfo asi = new ActionScheduleInfo(); if (seed % 2 == 0) asi.StartDate = DateTime.Now; if (seed % 3 == 0) asi.DueDate = DateTime.Now.AddDays(seed % 7); return asi; }
public void It_Must_Raise_NotifyProperty_Changed_On_ScheduleInfo() { GtdAction a = new GtdAction(); ActionScheduleInfo asi = new ActionScheduleInfo(); InitializeINotifyPropertyChangeInstance(a); a.Schedule = asi; string expected = "Schedule"; var actual = GetInfoRegardingPropertyName(); Assert.AreEqual<string>(expected, actual, "Property Schedule must change"); }
public void It_Must_Be_A_ToDo_Action_If_DueDate_Is_Null() { GtdAction a = new GtdAction(); DateTime sd = DateTime.Now; var asi = new ActionScheduleInfo(sd, default(DateTime?)); a.Schedule = asi; var expected = KindOfGtdAction.Todo; var actual = GtdAction.KindOf(a); Assert.AreEqual<KindOfGtdAction>(expected, actual, "Action must be ToDo because DueDate is null"); }
public void It_Must_Be_A_ToDo_Action_If_DueDate_Is_In_The_Future_Of_Today() { GtdAction a = new GtdAction(); DateTime dd = DateTime.Now.AddDays(1); var asi = new ActionScheduleInfo(default(DateTime?), dd); a.Schedule = asi; var expected = KindOfGtdAction.Todo; var actual = GtdAction.KindOf(a); Assert.AreEqual<KindOfGtdAction>(expected, actual, "Action must be ToDo because Schedule is null"); }
public void It_Must_Be_A_Passed_Action_If_DueDate_Is_Previous_To_Today() { GtdAction a = new GtdAction(); DateTime dd = DateTime.Now.AddDays(-1); ActionScheduleInfo asi = new ActionScheduleInfo(default(DateTime?), dd); a.Schedule = asi; var expected = KindOfGtdAction.Passed; var actual = GtdAction.KindOf(a); Assert.AreEqual<KindOfGtdAction>(expected, actual, "Action must be Passed because DueDate was yesterday"); }
public void It_Must_Be_A_Today_Action_If_DueDate_Is_Whithin_Today() { GtdAction a = new GtdAction(); DateTime dd = ScheduleInfoTestHelper.CreateForEndOfDay(DateTime.Now); ActionScheduleInfo asi = new ActionScheduleInfo(default(DateTime?), dd); a.Schedule = asi; var expected = KindOfGtdAction.Today; var actual = GtdAction.KindOf(a); Assert.AreEqual<KindOfGtdAction>(expected, actual, "Action must be Today because DueDate is whithin today"); }
public void TestConstructorWithStartAndDueDateBothNull() { DateTime dt1 = DateTime.Now; DateTime? sd = default(DateTime?); DateTime? dd = default(DateTime?); ActionScheduleInfo asi = new ActionScheduleInfo(sd, dd); DateTime dt2 = DateTime.Now; Assert.IsFalse(asi.StartDate.HasValue); Assert.IsFalse(asi.DueDate.HasValue); Assert.IsTrue(dt1 <= asi.CreationDate); Assert.IsTrue(dt2 >= asi.CreationDate); }
public void TestConstructorWithStartAndDueDateNotNullAndCreationTimeDefined() { DateTime? sd = DateTime.Now; DateTime? dd = sd.Value.AddHours(10); DateTime ct = DateTime.Now.AddHours(-1); ActionScheduleInfo asi = new ActionScheduleInfo(sd, dd, ct); Assert.IsTrue(asi.StartDate.HasValue); Assert.IsTrue(asi.DueDate.HasValue); Assert.AreEqual<DateTime?>(sd.Value, asi.StartDate); Assert.AreEqual<DateTime?>(dd.Value, asi.DueDate); Assert.AreEqual<DateTime>(ct, asi.CreationDate); }
public void TestChangeActionScheduleInfo() { Guid id = Guid.NewGuid(); string title = "Title"; string description = "Description"; DateTime startDate = DateTime.Now; DateTime dueDate = startDate.AddDays(1); ActionScheduleInfo asi = new ActionScheduleInfo(startDate, dueDate); var ac = new GtdAction(id, title, description); ac.Schedule = asi; Assert.IsNotNull(ac.Schedule); Assert.AreEqual<ActionScheduleInfo>(asi, ac.Schedule); }
public void It_Must_Raise_PropertyChanged_On_DueDate() { DateTime? dd = DateTime.Now; string propertyName = "DueDate"; string actual = String.Empty; var asi = new ActionScheduleInfo(); InitializeINotifyPropertyChangeInstance(asi); asi.DueDate = dd; actual = GetInfoRegardingPropertyName(); Assert.AreEqual<string>(propertyName, actual, "Property called must be DueDate"); }
public void TestConstructorWithStartAndDueDateNotNull() { DateTime dt1 = DateTime.Now; DateTime? sd = DateTime.Now; DateTime? dd = sd.Value.AddHours(10) ; ActionScheduleInfo asi = new ActionScheduleInfo(sd, dd); DateTime dt2 = DateTime.Now; Assert.IsTrue(asi.StartDate.HasValue); Assert.IsTrue(asi.DueDate.HasValue); Assert.AreEqual<DateTime?>(sd.Value, asi.StartDate); Assert.AreEqual<DateTime?>(dd.Value, asi.DueDate); Assert.IsTrue(dt1 <= asi.CreationDate); Assert.IsTrue(dt2 >= asi.CreationDate); }
public void TestKindOfGtdEntityActionWithNotDefinedDueDate() { Guid id = Guid.NewGuid(); GtdAction action = new GtdAction(id, "Title", "Description"); ActionScheduleInfo asi = new ActionScheduleInfo(); asi.StartDate = DateTime.Now; }
public void TestTwoSchedulesWithSameStartDatesButDifferentDueDatesEquality() { ActionScheduleInfo asi1 = new ActionScheduleInfo(); ActionScheduleInfo asi2 = new ActionScheduleInfo(); DateTime sd1 = DateTime.Now; DateTime sd2 = sd1; ; DateTime dd1 = DateTime.Now; DateTime dd2 = dd1.AddTicks(1); asi1.StartDate = sd1; asi1.DueDate = dd1; asi2.StartDate = sd2; asi2.DueDate = dd2; Assert.AreNotEqual<ActionScheduleInfo>(asi1, asi2); }
public void TestTwoSchedulesWithSameDueAndStartDatesAndEqualCreationDateEquality() { ActionScheduleInfo asi1 = new ActionScheduleInfo(); ActionScheduleInfo asi2 = new ActionScheduleInfo(); DateTime sd1 = DateTime.Now; DateTime sd2 = sd1; DateTime dd1 = DateTime.Now; DateTime dd2 = dd1; DateTime cd1 = DateTime.Now; DateTime cd2 = cd1; asi1.StartDate = sd1; asi1.DueDate = dd1; asi2.StartDate = sd2; asi2.DueDate = dd2; asi1.CreationDate = cd1; asi2.CreationDate = cd2; Assert.AreEqual<ActionScheduleInfo>(asi1, asi2); }
public void TestTwoSchedulesWithNotInitializedStartDatesAndIdenticalDueDatesEquality() { ActionScheduleInfo asi1 = new ActionScheduleInfo(); ActionScheduleInfo asi2 = new ActionScheduleInfo(); DateTime dd1 = DateTime.Now; DateTime dd2 = dd1; asi1.DueDate = dd1; asi2.DueDate = dd2; Assert.AreNotEqual<ActionScheduleInfo>(asi1, asi2); }
public void TestTwoDefaultSchedulesEquality() { ActionScheduleInfo asi1 = new ActionScheduleInfo(); ActionScheduleInfo asi2 = new ActionScheduleInfo(); Assert.AreNotEqual<ActionScheduleInfo>(asi1, asi2); }
public void TestSetPropertyOnStartDate() { ActionScheduleInfo asi = new ActionScheduleInfo(); DateTime? sd = DateTime.Now; string propName = "StartDate"; string changeOnProp = string.Empty; asi.PropertyChanged += delegate (object o, System.ComponentModel.PropertyChangedEventArgs e) { changeOnProp = e.PropertyName; }; asi.StartDate = sd; Assert.IsFalse(string.IsNullOrEmpty(changeOnProp)); Assert.AreEqual<string>(propName, changeOnProp); Assert.IsTrue(asi.StartDate.HasValue); Assert.AreEqual<DateTime?>(sd.Value, asi.StartDate); }
public void TestSetPropertyOnCreationDate() { ActionScheduleInfo asi = new ActionScheduleInfo(); DateTime cd = DateTime.Now; string propName = "CreationDate"; string changeOnProp = string.Empty; asi.PropertyChanged += delegate (object o, System.ComponentModel.PropertyChangedEventArgs e) { changeOnProp = e.PropertyName; }; asi.CreationDate = cd; Assert.IsFalse(string.IsNullOrEmpty(changeOnProp)); Assert.AreEqual<string>(propName, changeOnProp); Assert.AreEqual<DateTime?>(cd, asi.CreationDate); }
public void TestDefaultConstructor() { DateTime dt1 = DateTime.Now; ActionScheduleInfo asi = new ActionScheduleInfo(); DateTime dt2 = DateTime.Now; Assert.IsFalse(asi.StartDate.HasValue); Assert.IsFalse(asi.DueDate.HasValue); Assert.IsTrue(dt1 <= asi.CreationDate); Assert.IsTrue(dt2 >= asi.CreationDate); }