public void Test_DaysBetweenStartAndEnd() { DateTime start = new DateTime(2013, 6, 28); DateTime end = new DateTime(2013, 6, 30); var x = new DateRange(start, end); Assert.AreEqual((end - start).TotalDays, x.DaysBetweenStartAndEnd); }
public void Test_Days_Constructor() { DateTime start = new DateTime(2013, 6, 28); int days = 7; var x = new DateRange(start, days); Assert.AreEqual(start.AddDays(7), x.End); }
public void Test_DaysBetween_End() { DateTime start = new DateTime(2013, 6, 28); DateTime end = new DateTime(2013, 6, 30); DateTime test = new DateTime(2013, 7, 5); var x = new DateRange(start, end); Assert.AreEqual(5, x.DaysBetweenEnd(test)); }
public void Test_DaysBetweenStart() { DateTime start = new DateTime(2013, 6, 28); DateTime end = new DateTime(2013, 6, 30); DateTime test = new DateTime(2013, 6, 29); var x = new DateRange(start, end); Assert.AreEqual(1, x.DaysBetweenStart(test)); }
public void Test_ChangeStartDate() { DateTime start = new DateTime(2013, 6, 28, 0, 0, 0); DateTime end = new DateTime(2013, 6, 30); var x = new DateRange(start, end); x.ChangeStartDate(5); Assert.AreEqual(new DateTime(2013, 7, 3, 0, 0, 0), x.Start); }
public void Test_End_Days_Constructor() { DateTime end = new DateTime(2013, 6, 28); int days = -7; var x = new DateRange(days, end); Assert.AreEqual(end.AddDays(days), x.Start); }
public void Test_Standard_Constructor() { DateTime start = new DateTime(2013, 6, 28); DateTime end = new DateTime(2013, 6, 30); var x = new DateRange(start, end); Assert.AreEqual(start, x.Start); Assert.AreEqual(end, x.End); }
/// <summary> /// Parses from YYYMMDD. /// </summary> /// <param name="start">The start.</param> /// <param name="end">The end.</param> public static DateRange ParseFromYYYMMDD(string start, string end) { var range = new DateRange(); range.start = DateTime.ParseExact(start, "yyyyMMdd", CultureInfo.CurrentCulture); range.end = DateTime.ParseExact(end, "yyyyMMdd", CultureInfo.CurrentCulture); return range; }