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"); }
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"); }
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"); }