public void find_date_time_within() { var today = DateTime.Today; var from = today.AddHours(7); var to = today.AddHours(31); var period = new Period(from, to); period.FindDateTime("0700").ShouldEqual(today.AddHours(7)); period.FindDateTime("0800").ShouldEqual(today.AddHours(8)); period.FindDateTime("2300").ShouldEqual(today.AddHours(23)); period.FindDateTime("0500").ShouldEqual(today.AddHours(29)); // early morning the next day period.FindDateTime("0300").ShouldEqual(today.AddHours(27)); // early morning the next day }
public void find_date_time_within() { var today = DateTime.Today.ToLocal(); var from = today.Add(7.Hours()); var to = today.Add(31.Hours()); var period = new Period(from, to); period.FindDateTime("0700").ShouldEqual(today.Add(7.Hours())); period.FindDateTime("0800").ShouldEqual(today.Add(8.Hours())); period.FindDateTime("2300").ShouldEqual(today.Add(23.Hours())); period.FindDateTime("0500").ShouldEqual(today.Add(29.Hours())); // early morning the next day period.FindDateTime("0300").ShouldEqual(today.Add(27.Hours())); // early morning the next day }
public void SetUp() { thePeriod = new Period(DateTime.Now); }
public bool Equals(Period other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return Equals(other.From, From) && Equals(other.To, To); }
public void SetUp() { thePeriod = new Period(DateTime.Now.ToLocal()); }