Exemplo n.º 1
0
        public void DateTimeNowAddDaysNegativeWorksBetweenTwoMonths()
        {
            MoveToEndOfMonth();
            var expectedDay = new FakeDateTime(this.date);

            this.date = this.date.AddDays(1);
            this.date = this.date.AddDays(-1);

            Assert.That(expectedDay.CompareTo(this.date), Is.EqualTo(0), "Date does not decrement properly on end of month!");
        }
Exemplo n.º 2
0
        public void DateTimeNowAddDaysNegativeWorks()
        {
            MakeDayTo(16);

            var expectedDateTime = new FakeDateTime(this.date);

            expectedDateTime.Day -= 1;

            Assert.That(expectedDateTime.CompareTo(this.date.AddDays(-1)), Is.EqualTo(0), "Dates cannot be reverted.");
        }
Exemplo n.º 3
0
        public void DateTimeNowAddDaysInMiddleOfMonthIncrementsProperly()
        {
            MakeDayTo(15);

            var expectedDate = new FakeDateTime(this.date);

            expectedDate.Day++;

            Assert.That(expectedDate.CompareTo(this.date.AddDays(1)), Is.EqualTo(0), "The DateTime does not increment days correctly!");
        }
Exemplo n.º 4
0
        public void DateTimeNowAddDaysChangesMonthWhenAddingDayAtTheEnd()
        {
            MoveToEndOfMonth();

            var expectedDate = new FakeDateTime(this.date)
            {
                Day = 1
            };

            expectedDate.Month = expectedDate.Month == 12 ? 1 : expectedDate.Month + 1;
            expectedDate.Year  = expectedDate.Month == 1 ? expectedDate.Year + 1 : expectedDate.Year;

            Assert.That(expectedDate.CompareTo(this.date.AddDays(1)), Is.EqualTo(0), "DateTime.Now does not increment correctly at the end of the month");
        }