public void ReturnsFalseForHistoricYears(SectorTypes testSector)
        {
            // Arrange
            DateTime testSnapshotDate            = testSector.GetAccountingStartDate();
            int      testHistoricYear            = testSnapshotDate.Year;
            var      expectCalledGetSnapshotDate = false;

            // Mocks
            var mockService = new Mock <WebUI.Classes.Services.SubmissionService>(
                mockDataRepo.Object,
                mockScopeBL.Object,
                mockDraftFileBL.Object);

            mockService.CallBase = true;

            // Override GetPreviousReportingStartDate and return expectedYear
            mockService.Setup(ss => ss.GetSnapshotDate(It.IsIn(testSector), It.IsAny <int>()))
            .Returns(
                () => {
                expectCalledGetSnapshotDate = true;
                return(testSnapshotDate);
            });

            // Assert
            WebUI.Classes.Services.SubmissionService testService = mockService.Object;
            bool actual = testService.IsHistoricSnapshotYear(testSector, testHistoricYear);

            Assert.IsTrue(expectCalledGetSnapshotDate, "Expected to call GetSnapshotDate");
            Assert.IsFalse(actual, "Expected IsHistoricSnapshotYear to return false");
        }
Example #2
0
        public void ReturnsTrueForHistoricYears(SectorTypes testSector, int testHistoricYear)
        {
            // Mocks
            var mockService = new Mock <WebUI.Classes.Services.SubmissionService>(
                mockDataRepo.Object,
                mockScopeBL.Object,
                mockDraftFileBL.Object);

            mockService.CallBase = true;

            // Assert
            WebUI.Classes.Services.SubmissionService testService = mockService.Object;
            bool actual = testService.IsHistoricSnapshotYear(testSector, testHistoricYear);

            Assert.IsTrue(actual, "Expected IsHistoricSnapshotYear to return true");
        }
Example #3
0
        public void ReturnsTrueForCurrentYear(SectorTypes testSector)
        {
            // Arrange
            DateTime testSnapshotDate = testSector.GetAccountingStartDate();
            int      testYear         = testSnapshotDate.Year;

            // Mocks
            var testService = new WebUI.Classes.Services.SubmissionService(
                mockDataRepo.Object,
                mockScopeBL.Object,
                mockDraftFileBL.Object);

            // Assert
            bool actual = testService.IsCurrentSnapshotYear(testSector, testYear);

            Assert.IsTrue(actual, "Expected IsCurrentSnapshotYear to return true");
        }
Example #4
0
        public void ReturnsFalseForHistoricYears(SectorTypes testSector)
        {
            // Arrange
            DateTime testSnapshotDate = testSector.GetAccountingStartDate();
            int      testHistoricYear = testSnapshotDate.Year;

            // Mocks
            var mockService = new Mock <WebUI.Classes.Services.SubmissionService>(
                mockDataRepo.Object,
                mockScopeBL.Object,
                mockDraftFileBL.Object);

            mockService.CallBase = true;

            // Assert
            WebUI.Classes.Services.SubmissionService testService = mockService.Object;
            bool actual = testService.IsHistoricSnapshotYear(testSector, testHistoricYear);

            Assert.IsFalse(actual, "Expected IsHistoricSnapshotYear to return false");
        }