public async void GetComplianceYearsWithSubmittedMemberUploads_SchemeWithTwoSubmittedDataReturnsInDifferentYears_ReturnsBothYears() { const int firstComplianceYear = 1765; const int secondComplianceYear = 1766; const int quarter = 4; using (var databaseWrapper = new DatabaseWrapper()) { // Arrange var modelHelper = new ModelHelper(databaseWrapper.Model); var scheme = modelHelper.CreateScheme(); var firstDataReturn = modelHelper.CreateDataReturn(scheme, firstComplianceYear, quarter); var secondDataReturn = modelHelper.CreateDataReturn(scheme, secondComplianceYear, quarter); modelHelper.CreateDataReturnVersion(scheme, firstComplianceYear, quarter, true, firstDataReturn); modelHelper.CreateDataReturnVersion(scheme, secondComplianceYear, quarter, true, secondDataReturn); await databaseWrapper.Model.SaveChangesAsync(); // Act var dataAccess = new SchemeDataAccess(databaseWrapper.WeeeContext); var result = await dataAccess.GetComplianceYearsWithSubmittedDataReturns(scheme.Id); // Assert Assert.Equal(2, result.Count); Assert.Contains(firstComplianceYear, result); Assert.Contains(secondComplianceYear, result); } }
public async void GetComplianceYearsWithSubmittedDataReturns_SchemeHasSubmittedDataReturn_ReturnsCorrespondingComplianceYear() { const int complianceYear = 1666; const int quarter = 4; using (var databaseWrapper = new DatabaseWrapper()) { // Arrange var modelHelper = new ModelHelper(databaseWrapper.Model); var scheme = modelHelper.CreateScheme(); var dataReturn = modelHelper.CreateDataReturn(scheme, complianceYear, quarter); modelHelper.CreateDataReturnVersion(scheme, complianceYear, quarter, true, dataReturn); await databaseWrapper.Model.SaveChangesAsync(); // Act var dataAccess = new SchemeDataAccess(databaseWrapper.WeeeContext); var result = await dataAccess.GetComplianceYearsWithSubmittedDataReturns(scheme.Id); // Assert Assert.Single(result); Assert.Equal(complianceYear, result.Single()); } }
public async void GetComplianceYearsWithSubmittedDataReturns_SchemeWithTwoSubmittedDataReturnsUploadsInSameYear_ReturnsYearOnce() { const int complianceYear = 1888; const int firstDataReturnQuarter = 1; const int secondDataReturnQuarter = 2; using (var databaseWrapper = new DatabaseWrapper()) { // Arrange var modelHelper = new ModelHelper(databaseWrapper.Model); var scheme = modelHelper.CreateScheme(); var firstDataReturn = modelHelper.CreateDataReturn(scheme, complianceYear, firstDataReturnQuarter); var secondDataReturn = modelHelper.CreateDataReturn(scheme, complianceYear, secondDataReturnQuarter); modelHelper.CreateDataReturnVersion(scheme, complianceYear, firstDataReturnQuarter, true, firstDataReturn); modelHelper.CreateDataReturnVersion(scheme, complianceYear, secondDataReturnQuarter, true, secondDataReturn); await databaseWrapper.Model.SaveChangesAsync(); // Act var dataAccess = new SchemeDataAccess(databaseWrapper.WeeeContext); var result = await dataAccess.GetComplianceYearsWithSubmittedDataReturns(scheme.Id); // Assert Assert.Single(result); Assert.Equal(complianceYear, result.Single()); } }
public async void GetComplianceYearsWithSubmittedDataReturns_SchemeHasNoDataReturns_ReturnsNoYears() { using (var databaseWrapper = new DatabaseWrapper()) { // Arrange var modelHelper = new ModelHelper(databaseWrapper.Model); var scheme = modelHelper.CreateScheme(); await databaseWrapper.Model.SaveChangesAsync(); // Act var dataAccess = new SchemeDataAccess(databaseWrapper.WeeeContext); var result = await dataAccess.GetComplianceYearsWithSubmittedDataReturns(scheme.Id); // Assert Assert.Empty(result); } }
public async void GetComplianceYearsWithSubmittedMemberUploads_SchemeWithTwoSubmittedDataReturnsInDifferentYears_ReturnsBothYears() { const int firstComplianceYear = 1765; const int secondComplianceYear = 1766; const int quarter = 4; using (var databaseWrapper = new DatabaseWrapper()) { // Arrange var modelHelper = new ModelHelper(databaseWrapper.Model); var scheme = modelHelper.CreateScheme(); var firstDataReturn = modelHelper.CreateDataReturn(scheme, firstComplianceYear, quarter); var secondDataReturn = modelHelper.CreateDataReturn(scheme, secondComplianceYear, quarter); modelHelper.CreateDataReturnVersion(scheme, firstComplianceYear, quarter, true, firstDataReturn); modelHelper.CreateDataReturnVersion(scheme, secondComplianceYear, quarter, true, secondDataReturn); await databaseWrapper.Model.SaveChangesAsync(); // Act var dataAccess = new SchemeDataAccess(databaseWrapper.WeeeContext); var result = await dataAccess.GetComplianceYearsWithSubmittedDataReturns(scheme.Id); // Assert Assert.Equal(2, result.Count); Assert.Contains(firstComplianceYear, result); Assert.Contains(secondComplianceYear, result); } }
public async void GetComplianceYearsWithSubmittedDataReturns_SchemeWithTwoSubmittedDataReturnsUploadsInSameYear_ReturnsYearOnce() { const int complianceYear = 1888; const int firstDataReturnQuarter = 1; const int secondDataReturnQuarter = 2; using (var databaseWrapper = new DatabaseWrapper()) { // Arrange var modelHelper = new ModelHelper(databaseWrapper.Model); var scheme = modelHelper.CreateScheme(); var firstDataReturn = modelHelper.CreateDataReturn(scheme, complianceYear, firstDataReturnQuarter); var secondDataReturn = modelHelper.CreateDataReturn(scheme, complianceYear, secondDataReturnQuarter); modelHelper.CreateDataReturnVersion(scheme, complianceYear, firstDataReturnQuarter, true, firstDataReturn); modelHelper.CreateDataReturnVersion(scheme, complianceYear, secondDataReturnQuarter, true, secondDataReturn); await databaseWrapper.Model.SaveChangesAsync(); // Act var dataAccess = new SchemeDataAccess(databaseWrapper.WeeeContext); var result = await dataAccess.GetComplianceYearsWithSubmittedDataReturns(scheme.Id); // Assert Assert.Single(result); Assert.Equal(complianceYear, result.Single()); } }
public async void GetComplianceYearsWithSubmittedDataReturns_SchemeHasSubmittedDataReturn_ReturnsCorrespondingComplianceYear() { const int complianceYear = 1666; const int quarter = 4; using (var databaseWrapper = new DatabaseWrapper()) { // Arrange var modelHelper = new ModelHelper(databaseWrapper.Model); var scheme = modelHelper.CreateScheme(); var dataReturn = modelHelper.CreateDataReturn(scheme, complianceYear, quarter); modelHelper.CreateDataReturnVersion(scheme, complianceYear, quarter, true, dataReturn); await databaseWrapper.Model.SaveChangesAsync(); // Act var dataAccess = new SchemeDataAccess(databaseWrapper.WeeeContext); var result = await dataAccess.GetComplianceYearsWithSubmittedDataReturns(scheme.Id); // Assert Assert.Single(result); Assert.Equal(complianceYear, result.Single()); } }
public async void GetComplianceYearsWithSubmittedDataReturns_SchemeHasNoDataReturns_ReturnsNoYears() { using (var databaseWrapper = new DatabaseWrapper()) { // Arrange var modelHelper = new ModelHelper(databaseWrapper.Model); var scheme = modelHelper.CreateScheme(); await databaseWrapper.Model.SaveChangesAsync(); // Act var dataAccess = new SchemeDataAccess(databaseWrapper.WeeeContext); var result = await dataAccess.GetComplianceYearsWithSubmittedDataReturns(scheme.Id); // Assert Assert.Empty(result); } }