Beispiel #1
0
        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").ShouldBe(today.Add(7.Hours()));
            period.FindDateTime("0800").ShouldBe(today.Add(8.Hours()));
            period.FindDateTime("2300").ShouldBe(today.Add(23.Hours()));
            period.FindDateTime("0500").ShouldBe(today.Add(29.Hours())); // early morning the next day
            period.FindDateTime("0300").ShouldBe(today.Add(27.Hours())); // early morning the next day
        }