public async void NotUsingFixedDate_TimeNowBeforeQuarterWindow_ValidationError_StatingWindowNotYetOpened()
        {
            var systemData = new TestSystemData();
            systemData.ToggleFixedCurrentDateUsage(false);

            A.CallTo(() => systemDataDataAccess.Get())
                .Returns(systemData);

            var timeNow = new DateTime(2015, 12, 31, 23, 59, 59);

            var windowStart = new DateTime(2016, 1, 1, 0, 0, 0);
            var windowEnd = new DateTime(2016, 1, 2, 0, 0, 0);

            A.CallTo(() => quarterWindowFactory.GetQuarterWindow(A<Quarter>._))
                .Returns(new QuarterWindow(windowStart, windowEnd));

            SystemTime.Freeze(timeNow, true);

            var result = await
                SubmissionWindowClosed()
                    .Validate(new Quarter(2016, QuarterType.Q1));

            SystemTime.Unfreeze();

            Assert.Single(result);

            var error = result.Single();

            Assert.Equal(Core.Shared.ErrorLevel.Error, error.ErrorLevel);
            Assert.Contains("not yet opened", error.Description);
            Assert.Contains("2016", error.Description);
        }
        public async void NotUsingFixedDate_TimeNowIsWithinQuarterWindow_NoValidationError()
        {
            var systemData = new TestSystemData();
            systemData.ToggleFixedCurrentDateUsage(false);

            A.CallTo(() => systemDataDataAccess.Get())
                .Returns(systemData);

            var timeNow = new DateTime(2016, 1, 1, 0, 0, 0);

            var windowStart = new DateTime(2016, 1, 1, 0, 0, 0);
            var windowEnd = new DateTime(2016, 1, 2, 0, 0, 0);

            A.CallTo(() => quarterWindowFactory.GetQuarterWindow(A<Quarter>._))
                .Returns(new QuarterWindow(windowStart, windowEnd));

            SystemTime.Freeze(timeNow, true);

            var result = await
                SubmissionWindowClosed()
                    .Validate(new Quarter(2016, QuarterType.Q1));

            SystemTime.Unfreeze();

            Assert.Empty(result);
        }
Esempio n. 3
0
        public async void NotUsingFixedDate_TimeNowBeforeQuarterWindow_ValidationError_StatingWindowNotYetOpened()
        {
            var systemData = new TestSystemData();

            systemData.ToggleFixedCurrentDateUsage(false);

            A.CallTo(() => systemDataDataAccess.Get())
            .Returns(systemData);

            var timeNow = new DateTime(2015, 12, 31, 23, 59, 59);

            var windowStart = new DateTime(2016, 1, 1, 0, 0, 0);
            var windowEnd   = new DateTime(2016, 1, 2, 0, 0, 0);

            A.CallTo(() => quarterWindowFactory.GetQuarterWindow(A <Quarter> ._))
            .Returns(new QuarterWindow(windowStart, windowEnd, QuarterType.Q1));

            SystemTime.Freeze(timeNow, true);

            var result = await
                         SubmissionWindowClosed()
                         .Validate(new Quarter(2016, QuarterType.Q1));

            SystemTime.Unfreeze();

            Assert.Single(result);

            var error = result.Single();

            Assert.Equal(Core.Shared.ErrorLevel.Error, error.ErrorLevel);
            Assert.Contains("not yet opened", error.Description);
            Assert.Contains("2016", error.Description);
        }
Esempio n. 4
0
        public async void NotUsingFixedDate_TimeNowIsWithinQuarterWindow_NoValidationError()
        {
            var systemData = new TestSystemData();

            systemData.ToggleFixedCurrentDateUsage(false);

            A.CallTo(() => systemDataDataAccess.Get())
            .Returns(systemData);

            var timeNow = new DateTime(2016, 1, 1, 0, 0, 0);

            var windowStart = new DateTime(2016, 1, 1, 0, 0, 0);
            var windowEnd   = new DateTime(2016, 1, 2, 0, 0, 0);

            A.CallTo(() => quarterWindowFactory.GetQuarterWindow(A <Quarter> ._))
            .Returns(new QuarterWindow(windowStart, windowEnd, QuarterType.Q1));

            SystemTime.Freeze(timeNow, true);

            var result = await
                         SubmissionWindowClosed()
                         .Validate(new Quarter(2016, QuarterType.Q1));

            SystemTime.Unfreeze();

            Assert.Empty(result);
        }
Esempio n. 5
0
        private void SetupSystemTime()
        {
            var testSystemData = new TestSystemData();

            testSystemData.ToggleFixedCurrentDateUsage(false);

            A.CallTo(() => systemDataDataAccess.Get()).Returns(testSystemData);
        }
Esempio n. 6
0
        private void SetupFixedDate(DateTime date)
        {
            var testSystemData = new TestSystemData();

            testSystemData.ToggleFixedCurrentDateUsage(true);
            testSystemData.UpdateFixedCurrentDate(date);

            A.CallTo(() => systemDataDataAccess.Get()).Returns(testSystemData);
        }