public List <SubscriptTypeEntity> GetActiveSubscriptTypeList() { _commonDataAccess = new CommonDataAccess(_context); var lst = _commonDataAccess.GetActiveSubscriptType(); return(lst); }
public FetchPendingChargesHandler( IWeeeAuthorization authorization, ICommonDataAccess dataAccess) { this.authorization = authorization; this.dataAccess = dataAccess; }
public FetchInvoiceRunIbisZipFileHandler( IWeeeAuthorization authorization, ICommonDataAccess dataAccess) { this.authorization = authorization; this.dataAccess = dataAccess; }
public FetchComplianceYearsWithInvoicesHandler( IWeeeAuthorization authorization, ICommonDataAccess dataAccess) { this.authorization = authorization; this.dataAccess = dataAccess; }
public void DataLoader_ConstructorParameterOfficerDataMapperNull_ReturnsException() { ICommonDataAccess fakeDataAccess = NSubstitute.Substitute.For <ICommonDataAccess>(); IOfficerDataMapper fakeOfficerDataMapper = null; Assert.Throws <ArgumentNullException>(() => new DataLoader(fakeDataAccess, fakeOfficerDataMapper)); }
public GetAllAatfReuseSitesCsvHandler(IWeeeAuthorization authorization, WeeeContext weeContext, CsvWriterFactory csvWriterFactory, ICommonDataAccess commonDataAccess) { this.authorization = authorization; this.weeContext = weeContext; this.commonDataAccess = commonDataAccess; this.csvWriterFactory = csvWriterFactory; }
public FetchSchemesWithInvoicesHandler( IWeeeAuthorization authorization, ICommonDataAccess dataAccess, IMap <Scheme, SchemeData> schemeMap) { this.authorization = authorization; this.dataAccess = dataAccess; this.schemeMap = schemeMap; }
public AddAatfRequestHandlerTests() { addressMapper = A.Fake <IMap <AatfAddressData, AatfAddress> >(); contactMapper = A.Fake <IMap <AatfContactData, AatfContact> >(); dataAccess = A.Fake <IGenericDataAccess>(); commonDataAccess = A.Fake <ICommonDataAccess>(); handler = new AddAatfRequestHandler(AuthorizationBuilder.CreateUserWithAllRights(), dataAccess, addressMapper, contactMapper, commonDataAccess); }
public DefaultSearchEntity GetShowhidePanelByUserId(UserEntity user, string currentPage) { if (user != null) { _commonDataAccess = new CommonDataAccess(_context); return(_commonDataAccess.GetShowhidePanelByUserId(user.UserId, currentPage)); } return(null); }
public FetchInvoiceRunCsvHandler(IWeeeAuthorization authorization, WeeeContext context, ICommonDataAccess commonDataAccess, CsvWriterFactory csvWriterFactory) { this.authorization = authorization; this.context = context; this.commonDataAccess = commonDataAccess; this.csvWriterFactory = csvWriterFactory; }
public GetAatfAeDetailsCsvHandler(IWeeeAuthorization authorization, WeeeContext context, CsvWriterFactory csvWriterFactory, ICommonDataAccess commonDataAccess) { this.authorization = authorization; this.context = context; this.csvWriterFactory = csvWriterFactory; this.commonDataAccess = commonDataAccess; }
public GetPcsAatfComparisonDataHandler(IWeeeAuthorization authorization, WeeeContext context, CsvWriterFactory csvWriterFactory, ICommonDataAccess commonDataAccess) { this.authorization = authorization; this.context = context; this.csvWriterFactory = csvWriterFactory; this.commonDataAccess = commonDataAccess; }
public GetAllAatfReuseSitesCsvHandlerTests() { var authorization = new AuthorizationBuilder().AllowInternalAreaAccess().Build(); context = A.Fake <WeeeContext>(); csvWriterFactory = A.Fake <CsvWriterFactory>(); commonDataAccess = A.Fake <ICommonDataAccess>(); handler = new GetAllAatfReuseSitesCsvHandler(authorization, context, csvWriterFactory, commonDataAccess); }
public void DataLoader_ConstructorParametersAreNotNull_ReturnsDataLoader() { ICommonDataAccess fakeDataAccess = NSubstitute.Substitute.For <ICommonDataAccess>(); IOfficerDataMapper fakeOfficerDataMapper = NSubstitute.Substitute.For <IOfficerDataMapper>(); var dataLoader = new DataLoader(fakeDataAccess, fakeOfficerDataMapper); Assert.NotNull(dataLoader); }
public async Task HandleAysnc_HappyPath_ReturnsFileInfoWithCorrectFileName() { // Arrange IWeeeAuthorization authorization = AuthorizationBuilder.CreateUserWithAllRights(); UKCompetentAuthority authority = new UKCompetentAuthority( A.Dummy <Guid>(), "Environment Agency", "EA", A.Dummy <Country>(), "*****@*****.**", 0); Scheme scheme = A.Dummy <Scheme>(); A.CallTo(() => scheme.CompetentAuthority).Returns(authority); MemberUpload memberUpload = new MemberUpload( A.Dummy <Guid>(), scheme, A.Dummy <string>(), A.Dummy <string>()); memberUpload.Submit(A.Dummy <User>()); List <MemberUpload> memberUploads = new List <MemberUpload>(); memberUploads.Add(memberUpload); SystemTime.Freeze(new DateTime(2015, 12, 31)); InvoiceRun invoiceRun = new InvoiceRun(authority, memberUploads, A.Dummy <User>()); SystemTime.Unfreeze(); ulong fileID = 123; IbisFileData ibisFileData = new IbisFileData(fileID, "Customer File.dat", "data", "Transaction File.dat", "data"); invoiceRun.SetIbisFileData(ibisFileData); ICommonDataAccess dataAccess = A.Fake <ICommonDataAccess>(); A.CallTo(() => dataAccess.FetchInvoiceRunAsync(A <Guid> ._)).Returns(invoiceRun); FetchInvoiceRunIbisZipFileHandler handler = new FetchInvoiceRunIbisZipFileHandler( authorization, dataAccess); // Act FileInfo fileInfo = await handler.HandleAsync(A.Dummy <Requests.Charges.FetchInvoiceRunIbisZipFile>()); // Assert Assert.NotNull(fileInfo); Assert.Equal("WEEE invoice files 00123 2015-12-31.zip", fileInfo.FileName); }
public GetAllAatfSentOnDataCsvHandlerTests() { context = A.Fake <WeeeContext>(); commonDataAccess = A.Fake <ICommonDataAccess>(); storedProcedures = A.Fake <IStoredProcedures>(); fixture = new Fixture(); A.CallTo(() => context.StoredProcedures).Returns(storedProcedures); handler = new GetAllAatfSentOnDataCsvHandler(new AuthorizationBuilder().AllowInternalAreaAccess().Build(), context, commonDataAccess); }
public IDictionary <string, string> GetRelationshipSelectList() { _commonDataAccess = new CommonDataAccess(_context); var lst = _commonDataAccess.GetActiveRelationship(); return((from x in lst select new { key = x.RelationshipId.ToString(CultureInfo.InvariantCulture), value = x.RelationshipName }).ToDictionary(t => t.key, t => t.value)); }
public IDictionary <string, string> GetPhoneTypeSelectList() { _commonDataAccess = new CommonDataAccess(_context); var lst = _commonDataAccess.GetActivePhoneType(); return((from x in lst select new { key = x.PhoneTypeId.ToString(), value = x.PhoneTypeName }).ToDictionary(t => t.key, t => t.value)); }
public IDictionary <string, string> GetTitleEnglishSelectList() { _commonDataAccess = new CommonDataAccess(_context); var lst = _commonDataAccess.GetActiveTitle(); return((from x in lst where x.Language.ToUpper(CultureInfo.InvariantCulture) == Constants.TitleLanguage.TitleEn select new { key = x.TitleId.ToString(), value = x.TitleName }).ToDictionary(t => t.key, t => t.value)); }
public AddAatfRequestHandler( IWeeeAuthorization authorization, IGenericDataAccess dataAccess, IMap <AatfAddressData, AatfAddress> addressMapper, IMap <AatfContactData, AatfContact> contactMapper, ICommonDataAccess commonDataAccess) { this.authorization = authorization; this.addressMapper = addressMapper; this.contactMapper = contactMapper; this.commonDataAccess = commonDataAccess; this.dataAccess = dataAccess; }
public IDictionary <string, string> GetAllMenu() { IDictionary <string, string> dic = new Dictionary <string, string>(); _commonDataAccess = new CommonDataAccess(_context); var result = _commonDataAccess.GetAllMenu(); foreach (var item in result) { dic.Add(item.MenuId.ToString(), item.MenuName); } return(dic); }
public IDictionary <string, string> GetAllScreen() { IDictionary <string, string> dic = new Dictionary <string, string>(); _commonDataAccess = new CommonDataAccess(_context); var result = _commonDataAccess.GetAllScreen(); foreach (var item in result) { dic.Add(item.ScreenId.ToString(CultureInfo.InvariantCulture), item.ScreenName); } return(dic); }
public GetPcsAatfComparisonDataHandlerTests() { context = A.Fake <WeeeContext>(); csvWriterFactory = A.Fake <CsvWriterFactory>(); fixture = new Fixture(); storedProcedures = A.Fake <IStoredProcedures>(); commonDataAccess = A.Fake <ICommonDataAccess>(); A.CallTo(() => context.StoredProcedures).Returns(storedProcedures); handler = new GetPcsAatfComparisonDataHandler(new AuthorizationBuilder().AllowInternalAreaAccess().Build(), context, csvWriterFactory, commonDataAccess); }
private List <ScreenEntity> GetCacheScreenRoles() { // Check the cache List <ScreenEntity> screenRoles = CacheLayer.Get <List <ScreenEntity> >(Constants.CacheKey.ScreenRoles); if (screenRoles == null) { _commonDataAccess = new CommonDataAccess(_context); List <ScreenEntity> screenList = _commonDataAccess.GetScreenList(); // Then add it to the cache so we // can retrieve it from there next time CacheLayer.Add(screenList, Constants.CacheKey.ScreenRoles); screenRoles = CacheLayer.Get <List <ScreenEntity> >(Constants.CacheKey.ScreenRoles); } return(screenRoles); }
private List <MenuEntity> GetCacheMainMenu() { // Check the cache List <MenuEntity> mainMenu = CacheLayer.Get <List <MenuEntity> >(Constants.CacheKey.MainMenu); if (mainMenu == null) { _commonDataAccess = new CommonDataAccess(_context); List <MenuEntity> menuItems = _commonDataAccess.GetMenuList(); // Then add it to the cache so we // can retrieve it from there next time CacheLayer.Add(menuItems, Constants.CacheKey.MainMenu); mainMenu = CacheLayer.Get <List <MenuEntity> >(Constants.CacheKey.MainMenu); } return(mainMenu); }
private List <ParameterEntity> GetCacheParameters() { // Check the cache List <ParameterEntity> parameters = CacheLayer.Get <List <ParameterEntity> >(Constants.CacheKey.AllParameters); if (parameters == null) { _commonDataAccess = new CommonDataAccess(_context); List <ParameterEntity> lstParameter = _commonDataAccess.GetAllParameters(); // Then add it to the cache so we // can retrieve it from there next time CacheLayer.Add(lstParameter, Constants.CacheKey.AllParameters); parameters = CacheLayer.Get <List <ParameterEntity> >(Constants.CacheKey.AllParameters); } return(parameters); }
public EditAatfDetailsRequestHandler( IWeeeAuthorization authorization, IAatfDataAccess aatfDataAccess, IGenericDataAccess genericDataAccess, IMap <AatfAddressData, AatfAddress> addressMapper, IOrganisationDetailsDataAccess organisationDetailsDataAccess, ICommonDataAccess commonDataAccess, IGetAatfApprovalDateChangeStatus getAatfApprovalDateChangeStatus, IQuarterWindowFactory quarterWindowFactory, IWeeeTransactionAdapter context) { this.authorization = authorization; this.genericDataAccess = genericDataAccess; this.aatfDataAccess = aatfDataAccess; this.addressMapper = addressMapper; this.organisationDetailsDataAccess = organisationDetailsDataAccess; this.commonDataAccess = commonDataAccess; this.getAatfApprovalDateChangeStatus = getAatfApprovalDateChangeStatus; this.quarterWindowFactory = quarterWindowFactory; this.context = context; }
public async Task HandleAsync_WithInvoiceRunWithout1B1SFileData_ThrowsInvalidOperationException() { // Arrange IWeeeAuthorization authorization = AuthorizationBuilder.CreateUserWithAllRights(); UKCompetentAuthority authority = A.Dummy <UKCompetentAuthority>(); Scheme scheme = A.Dummy <Scheme>(); A.CallTo(() => scheme.CompetentAuthority).Returns(authority); MemberUpload memberUpload = new MemberUpload( A.Dummy <Guid>(), scheme, A.Dummy <string>(), A.Dummy <string>()); memberUpload.Submit(A.Dummy <User>()); List <MemberUpload> memberUploads = new List <MemberUpload>(); memberUploads.Add(memberUpload); InvoiceRun invoiceRun = new InvoiceRun(authority, memberUploads, A.Dummy <User>()); ICommonDataAccess dataAccess = A.Fake <ICommonDataAccess>(); A.CallTo(() => dataAccess.FetchInvoiceRunAsync(A <Guid> ._)).Returns(invoiceRun); FetchInvoiceRunIbisZipFileHandler handler = new FetchInvoiceRunIbisZipFileHandler( authorization, dataAccess); // Act Func <Task <FileInfo> > testCode = async() => await handler.HandleAsync(A.Dummy <Requests.Charges.FetchInvoiceRunIbisZipFile>()); // Assert await Assert.ThrowsAsync <InvalidOperationException>(testCode); }
public EditAatfDetailsRequestHandlerTests() { fixture = new Fixture(); var authorization = A.Fake <IWeeeAuthorization>(); genericDataAccess = A.Fake <IGenericDataAccess>(); aatfDataAccess = A.Fake <IAatfDataAccess>(); addressMapper = A.Fake <IMap <AatfAddressData, AatfAddress> >(); organisationDetailsDataAccess = A.Fake <IOrganisationDetailsDataAccess>(); commonDataAccess = A.Fake <ICommonDataAccess>(); getAatfApprovalDateChangeStatus = A.Fake <IGetAatfApprovalDateChangeStatus>(); quarterWindowFactory = A.Fake <IQuarterWindowFactory>(); context = A.Fake <IWeeeTransactionAdapter>(); handler = new EditAatfDetailsRequestHandler(authorization, aatfDataAccess, genericDataAccess, addressMapper, organisationDetailsDataAccess, commonDataAccess, getAatfApprovalDateChangeStatus, quarterWindowFactory, context); }
public int GetBranchCountByName(string searchTerm, int pageSize, int pageNum, int?userId) { _commonDataAccess = new CommonDataAccess(_context); return(_commonDataAccess.GetBranchCountByName(searchTerm, pageSize, pageNum, userId)); }