コード例 #1
0
ファイル: DateTimeNowTests.cs プロジェクト: vv-b-s/SoftUni
        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!");
        }
コード例 #2
0
ファイル: DateTimeNowTests.cs プロジェクト: vv-b-s/SoftUni
        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.");
        }
コード例 #3
0
ファイル: DateTimeNowTests.cs プロジェクト: vv-b-s/SoftUni
        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!");
        }
コード例 #4
0
ファイル: DateTimeNowTests.cs プロジェクト: vv-b-s/SoftUni
        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");
        }