- Problem 9. DateTime.Now.AddDays();
- Test the method DateTime.Now.AddDays(). Use mocking to provide the DateTime objects you need.
- It is important that you test DateTime.Now, so don't use new DateTime() for the tests.
- Some cases to consider:
- • Adding a day to the middle of the month, for example 16th June -> 17th June
- • Adding a day which will be in the next month (31st July -> 1st August)
- • Adding a negative value (-5 days), also check negative values which go on to the previous month
- • Adding a day to a leap year (28th February 2008 -> 29th February 2008)
- • Check the previous test with non-leap years (28th February 1900 -> 1st Match 1900)
- • Add a day to DateTime.MinValue and DateTime.MaxValue
- • Subtract a day from DateTime.MinValue and DateTime.MaxValue
- You can also make other tests if you wish.
RAW Paste Data