System.Tests.DateTimeTests.AddMonths_NewDateOutOfRange_ThrowsArgumentOutOfRangeException C# (CSharp) Method

AddMonths_NewDateOutOfRange_ThrowsArgumentOutOfRangeException() private method

        public static void AddMonths_NewDateOutOfRange_ThrowsArgumentOutOfRangeException()
        {
            Assert.Throws<ArgumentOutOfRangeException>("months", () => DateTime.Now.AddMonths(120001));
            Assert.Throws<ArgumentOutOfRangeException>("months", () => DateTime.Now.AddMonths(-120001));

            Assert.Throws<ArgumentOutOfRangeException>("months", () => DateTime.MaxValue.AddMonths(1));
            Assert.Throws<ArgumentOutOfRangeException>("months", () => DateTime.MinValue.AddMonths(-1));
        }
DateTimeTests