Advertisement
Guest User

Untitled

a guest
Apr 29th, 2018
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. Problem 9. DateTime.Now.AddDays();
  2. Test the method DateTime.Now.AddDays(). Use mocking to provide the DateTime objects you need.
  3. It is important that you test DateTime.Now, so don't use new DateTime() for the tests.
  4. Some cases to consider:
  5. • Adding a day to the middle of the month, for example 16th June -> 17th June
  6. • Adding a day which will be in the next month (31st July -> 1st August)
  7. • Adding a negative value (-5 days), also check negative values which go on to the previous month
  8. • Adding a day to a leap year (28th February 2008 -> 29th February 2008)
  9. • Check the previous test with non-leap years (28th February 1900 -> 1st Match 1900)
  10. • Add a day to DateTime.MinValue and DateTime.MaxValue
  11. • Subtract a day from DateTime.MinValue and DateTime.MaxValue
  12. You can also make other tests if you wish.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement