public void ResolveRelativeWithDayResolution() { DateTime now = DateTime.Now; WorklistTimePoint t1 = new WorklistTimePoint(TimeSpan.FromDays(1), WorklistTimePoint.Resolutions.Day); Assert.AreEqual(now.Date.AddDays(1), t1.ResolveDown(now)); Assert.AreEqual(now.Date.AddDays(2), t1.ResolveUp(now)); WorklistTimePoint t2 = new WorklistTimePoint(TimeSpan.FromDays(-1), WorklistTimePoint.Resolutions.Day); Assert.AreEqual(now.Date.AddDays(-1), t2.ResolveDown(now)); Assert.AreEqual(now.Date.AddDays(0), t2.ResolveUp(now)); // what if "now" happens to be right on the boundary?? DateTime midnight = DateTime.Now.Date; WorklistTimePoint t3 = new WorklistTimePoint(TimeSpan.FromDays(1), WorklistTimePoint.Resolutions.Day); Assert.AreEqual(midnight.AddDays(1), t1.ResolveDown(now)); Assert.AreEqual(midnight.AddDays(2), t1.ResolveUp(now)); WorklistTimePoint t4 = new WorklistTimePoint(TimeSpan.FromDays(-1), WorklistTimePoint.Resolutions.Day); Assert.AreEqual(midnight.AddDays(-1), t2.ResolveDown(now)); Assert.AreEqual(midnight.AddDays(0), t2.ResolveUp(now)); }
public void ResolveFixedWithDayResolution() { DateTime now = DateTime.Now; WorklistTimePoint t1 = new WorklistTimePoint(now.AddDays(1), WorklistTimePoint.Resolutions.Day); Assert.AreEqual(now.Date.AddDays(1), t1.ResolveDown(now)); Assert.AreEqual(now.Date.AddDays(2), t1.ResolveUp(now)); WorklistTimePoint t2 = new WorklistTimePoint(now.AddDays(-1), WorklistTimePoint.Resolutions.Day); Assert.AreEqual(now.Date.AddDays(-1), t2.ResolveDown(now)); Assert.AreEqual(now.Date.AddDays(0), t2.ResolveUp(now)); }
public void ResolveRelativeWithRealTimeResolution() { DateTime now = DateTime.Now; WorklistTimePoint t1 = new WorklistTimePoint(TimeSpan.FromDays(1), WorklistTimePoint.Resolutions.RealTime); Assert.AreEqual(now.AddDays(1), t1.ResolveDown(now)); Assert.AreEqual(now.AddDays(1), t1.ResolveUp(now)); WorklistTimePoint t2 = new WorklistTimePoint(TimeSpan.FromDays(-1), WorklistTimePoint.Resolutions.RealTime); Assert.AreEqual(now.AddDays(-1), t2.ResolveDown(now)); Assert.AreEqual(now.AddDays(-1), t2.ResolveUp(now)); }