Exemplo n.º 1
0
        public void ShouldThrowExceptionWhenRangeIsTooShort()
        {
            var    range    = new BatchDateRange(DateTimeExtensions.CreateNodaTime(2019, 2, 10, 0, 0, 0), DateTimeExtensions.CreateNodaTime(2019, 2, 2, 23, 59, 59));
            Action testCode = () => { range.Verify(); };
            var    ex       = Record.Exception(testCode);

            Assert.NotNull(ex);
            Assert.IsType <ArgumentException>(ex);
            Assert.Equal("Expected end datetime - start datetime to be 1 week - 1 hour, was: -168", ex.Message);
        }
Exemplo n.º 2
0
        public void ShouldThrowExceptionWhenEndIsNotSaturday()
        {
            var    range    = new BatchDateRange(DateTimeExtensions.CreateNodaTime(2019, 2, 10, 0, 0, 0), DateTimeExtensions.CreateNodaTime(2019, 2, 15, 23, 59, 59));
            Action testCode = () => { range.Verify(); };
            var    ex       = Record.Exception(testCode);

            Assert.NotNull(ex);
            Assert.IsType <ArgumentException>(ex);
            Assert.Equal("Expected end dateTime to be Saturday, was: Friday", ex.Message);
        }
Exemplo n.º 3
0
        public void ShouldThrowExceptionWhenEndIsNotAt235959()
        {
            var    range    = new BatchDateRange(DateTimeExtensions.CreateNodaTime(2019, 2, 10, 0, 0, 0), DateTimeExtensions.CreateNodaTime(2019, 2, 16, 23, 59, 58));
            Action testCode = () => { range.Verify(); };
            var    ex       = Record.Exception(testCode);

            Assert.NotNull(ex);
            Assert.IsType <ArgumentException>(ex);
            Assert.Equal("Expected end dateTime to be HH:MM:SS 23:59:59, was: 23:59:58", ex.Message);
        }
Exemplo n.º 4
0
        public void ShouldThrowExceptionWhenStartIsNotMidnight()
        {
            var range = new BatchDateRange(
                DateTimeExtensions.CreateNodaTime(2019, 2, 10, 0, 1, 0), DateTimeExtensions.CreateNodaTime(2019, 2, 16, 23, 59, 59));
            Action testCode = () => { range.Verify(); };
            var    ex       = Record.Exception(testCode);

            Assert.NotNull(ex);
            Assert.IsType <ArgumentException>(ex);
            Assert.Equal("Expected start dateTime to be HH:MM:SS 00:00:00, was: 00:01:00", ex.Message);
        }