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

AddMonths_NewDateOutOfRange_ThrowsArgumentOutOfRangeException() private method

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

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