Exemple #1
0
 public TransactionRepository(EmployerFinanceConfiguration configuration, IMapper mapper, ILog logger,
                              Lazy <EmployerFinanceDbContext> db)
     : base(configuration.DatabaseConnectionString, logger)
 {
     _mapper = mapper;
     _db     = db;
 }
 public DasLevyRepository(EmployerFinanceConfiguration configuration, ILog logger, Lazy <EmployerFinanceDbContext> db, ICurrentDateTime currentDateTime)
     : base(configuration.DatabaseConnectionString, logger)
 {
     _configuration   = configuration;
     _db              = db;
     _currentDateTime = currentDateTime;
 }
Exemple #3
0
        public void Arrange()
        {
            SetUp();
            _clientId    = "eas-fin";
            _contentType = "banner";

            EmployerFinanceConfiguration = new EmployerFinanceConfiguration()
            {
                ApplicationId = "eas-fin",
                DefaultCacheExpirationInMinutes = 1
            };
            Content  = "<p> Example content </p>";
            CacheKey = EmployerFinanceConfiguration.ApplicationId + "_banner";

            MockLogger              = new Mock <ILog>();
            MockContentService      = new Mock <IContentApiClient>();
            MockCacheStorageService = new Mock <ICacheStorageService>();


            MockContentService
            .Setup(cs => cs.Get(_contentType, _clientId))
            .ReturnsAsync(Content);

            Query = new GetContentRequest
            {
                ContentType = "banner"
            };

            RequestHandler = new GetContentRequestHandler(RequestValidator.Object, MockLogger.Object,
                                                          MockContentService.Object, MockCacheStorageService.Object, EmployerFinanceConfiguration);
        }
 public TestTransactionRepository(EmployerFinanceConfiguration configuration,
                                  ILog logger, Lazy <EmployerFinanceDbContext> employerFinanceDbContext)
     : base(configuration.DatabaseConnectionString, logger)
 {
     _employerFinanceDbContext = employerFinanceDbContext;
     _logger        = logger;
     _configuration = configuration;
 }
Exemple #5
0
 public GetTransferConnectionInvitationAuthorizationQueryHandler(
     Lazy <EmployerAccountsDbContext> accountDb,
     EmployerFinanceDbContext financeDb,
     EmployerFinanceConfiguration configuration,
     IAuthorizationService authorizationService)
 {
     _accountDb            = accountDb;
     _financeDb            = financeDb;
     _configuration        = configuration;
     _authorizationService = authorizationService;
 }
Exemple #6
0
 public GetContentRequestHandler(
     IValidator <GetContentRequest> validator,
     ILog logger,
     IContentApiClient service,
     ICacheStorageService cacheStorageService,
     EmployerFinanceConfiguration employerFinanceConfiguration
     )
 {
     _validator                    = validator;
     _logger                       = logger;
     _service                      = service;
     _cacheStorageService          = cacheStorageService;
     _employerFinanceConfiguration = employerFinanceConfiguration;
 }
Exemple #7
0
 public ExpireAccountFundsCommandHandler(
     ICurrentDateTime currentDateTime,
     ILevyFundsInRepository levyFundsInRepository,
     IPaymentFundsOutRepository paymentFundsOutRepository,
     IExpiredFunds expiredFunds,
     IExpiredFundsRepository expiredFundsRepository,
     ILog logger,
     EmployerFinanceConfiguration configuration)
 {
     _currentDateTime           = currentDateTime;
     _levyFundsInRepository     = levyFundsInRepository;
     _paymentFundsOutRepository = paymentFundsOutRepository;
     _expiredFunds           = expiredFunds;
     _expiredFundsRepository = expiredFundsRepository;
     _logger        = logger;
     _configuration = configuration;
 }
Exemple #8
0
        public void Arrange()
        {
            _configuration = new EmployerFinanceConfiguration
            {
                EmployerPortalBaseUrl = "https://localhost"
            };

            _dependancyResolver = new Mock <IDependencyResolver>();
            _dependancyResolver.Setup(r => r.GetService(typeof(EmployerFinanceConfiguration))).Returns(_configuration);

            DependencyResolver.SetResolver(_dependancyResolver.Object);

            _homeController =
                new HomeController(Mock.Of <IAuthenticationService>(), Mock.Of <EmployerFinanceConfiguration>())
            {
                Url = new UrlHelper()
            };
        }
Exemple #9
0
        public void Arrange()
        {
            _clientId    = "eas-fin";
            _contentType = "banner";

            EmployerFinanceConfig = new EmployerFinanceConfiguration()
            {
                ApplicationId = "eas-fin",
                DefaultCacheExpirationInMinutes = 1
            };
            ContentFromCache = "<p> Example content from cache </p>";
            ContentFromApi   = "<p> Example content from api </p>";
            CacheKey         = EmployerFinanceConfig.ApplicationId + "_banner";

            MockContentApiClient    = new Mock <IContentApiClient>();
            MockCacheStorageService = new Mock <ICacheStorageService>();

            ContentApiClientWithCaching = new ContentApiClientWithCaching(MockContentApiClient.Object, MockCacheStorageService.Object, EmployerFinanceConfig);
        }
Exemple #10
0
 public void Arrange()
 {
     _configuration = new EmployerFinanceConfiguration {
         TransferAllowancePercentage = .25m
     };
     _transferAllowance = new TransferAllowance
     {
         RemainingTransferAllowance = 123.456m,
         StartingTransferAllowance  = 234.56M,
     };
     _query    = new GetTransferAllowanceQuery();
     _response = new GetTransferAllowanceResponse {
         TransferAllowance = _transferAllowance, TransferAllowancePercentage = _configuration.TransferAllowancePercentage
     };
     _mapperConfig = new MapperConfiguration(c => c.AddProfile <TransferMappings>());
     _mapper       = _mapperConfig.CreateMapper();
     _mediator     = new Mock <IMediator>();
     _mediator.Setup(m => m.SendAsync(_query)).ReturnsAsync(_response);
     _controller = new TransfersController(null, _mapper, _mediator.Object);
 }
Exemple #11
0
        public void Arrange()
        {
            _mockDasLevyRepository = new Mock <IDasLevyRepository>();
            _mockLog            = new Mock <ILog>();
            _mockInProcessCache = new Mock <IInProcessCache>();
            var config = new EmployerFinanceConfiguration {
                ManageApprenticeshipsOuterApiConfiguration = new ManageApprenticeshipsOuterApiConfiguration {
                    BaseUrl = "http://BaseUrl.education.gov.uk", Key = "123"
                }
            };

            _container = new Container(c =>
            {
                c.AddRegistry <ManageApprenticeshipsOuterApiRegistry>();
                c.AddRegistry <ProvidersRegistry>();
                c.For <IDasLevyRepository>().Use(_mockDasLevyRepository.Object);
                c.For <EmployerFinanceConfiguration>().Use(config);
                c.For <ILog>().Use(_mockLog.Object);
                c.For <IInProcessCache>().Use(_mockInProcessCache.Object);
            });
        }
Exemple #12
0
 public GetTransferAllowanceQueryHandler(EmployerFinanceDbContext db, EmployerFinanceConfiguration configuration)
 {
     _db            = db;
     _configuration = configuration;
 }
Exemple #13
0
 public NServiceBusStartup(IContainer container, EmployerFinanceConfiguration employerFinanceConfiguration)
 {
     _container = container;
     _employerFinanceConfiguration = employerFinanceConfiguration;
 }
Exemple #14
0
 public CacheStorageService(IDistributedCache distributedCache, EmployerFinanceConfiguration config)
 {
     _distributedCache = distributedCache;
     _config           = config;
 }
 public AspNetStartup(IConfiguration configuration)
 {
     _employerFinanceConfiguration = configuration.GetEmployerFinanceSection <EmployerFinanceConfiguration>();
 }
 public ContentApiClientWithCaching(IContentApiClient contentApiClient, ICacheStorageService cacheStorageService, EmployerFinanceConfiguration employerFinanceConfiguration)
 {
     _contentApiClient             = contentApiClient;
     _cacheStorageService          = cacheStorageService;
     _employerFinanceConfiguration = employerFinanceConfiguration;
 }
Exemple #17
0
 public TransferAllowanceService(EmployerFinanceDbContext db, EmployerFinanceConfiguration configuration)
 {
     _db            = db;
     _configuration = configuration;
 }
 public HomeController(IAuthenticationService owinWrapper, EmployerFinanceConfiguration configuration)
 {
     _owinWrapper   = owinWrapper;
     _configuration = configuration;
 }
Exemple #19
0
 public IdentityServerConfigurationFactory(EmployerFinanceConfiguration configuration)
 {
     _configuration = configuration;
 }
Exemple #20
0
        public ExpireAccountFundsCommandHandlerTestsFixture()
        {
            Now                   = DateTime.UtcNow;
            NextMonth             = Now.AddMonths(1);
            MessageHandlerContext = new Mock <IMessageHandlerContext>();
            ExpectedAccountId     = 112L;
            Command               = new ExpireAccountFundsCommand {
                AccountId = ExpectedAccountId
            };
            FundsIn = new List <LevyFundsIn>
            {
                new LevyFundsIn {
                    CalendarPeriodYear = 2018, CalendarPeriodMonth = 07, FundsIn = 12000
                },
                new LevyFundsIn {
                    CalendarPeriodYear = 2018, CalendarPeriodMonth = 08, FundsIn = 15000
                }
            };
            FundsOut = new List <PaymentFundsOut>
            {
                new PaymentFundsOut {
                    CalendarPeriodYear = 2018, CalendarPeriodMonth = 09, FundsOut = 10000
                },
                new PaymentFundsOut {
                    CalendarPeriodYear = 2018, CalendarPeriodMonth = 10, FundsOut = 10000
                }
            };
            ExistingExpiredFunds = new List <ExpiredFund>
            {
                new ExpiredFund {
                    CalendarPeriodYear = 2018, CalendarPeriodMonth = 01, Amount = 2000
                },
                new ExpiredFund {
                    CalendarPeriodYear = 2018, CalendarPeriodMonth = 02, Amount = 2000
                }
            };
            ExpiringFunds = new Dictionary <CalendarPeriod, decimal>
            {
                { new CalendarPeriod(2018, 03), 1000 },
                { new CalendarPeriod(2018, 04), 1000 },
                { new CalendarPeriod(2018, 05), 0 },
                { new CalendarPeriod(NextMonth.Year, NextMonth.Month), 1000 }
            };
            ExpiredFunds = new Dictionary <CalendarPeriod, decimal>
            {
                { new CalendarPeriod(2018, 03), 1000 },
                { new CalendarPeriod(2018, 04), 1000 },
                { new CalendarPeriod(2018, 05), 0 },
                { new CalendarPeriod(Now.Year, Now.Month), 0 }
            };

            MockCurrentDateTime = new Mock <ICurrentDateTime>();
            FundsExpiryPeriod   = 18;

            MockLevyFundsInRepository     = new Mock <ILevyFundsInRepository>();
            MockPaymentFundsOutRepository = new Mock <IPaymentFundsOutRepository>();
            MockExpiredFunds           = new Mock <IExpiredFunds>();
            MockExpiredFundsRepository = new Mock <IExpiredFundsRepository>();
            MockLogger = new Mock <ILog>();
            EmployerFinanceConfiguration = new EmployerFinanceConfiguration {
                FundsExpiryPeriod = FundsExpiryPeriod
            };

            MockCurrentDateTime.Setup(x => x.Now).Returns(Now);
            MockLevyFundsInRepository.Setup(x => x.GetLevyFundsIn(ExpectedAccountId)).ReturnsAsync(FundsIn);
            MockPaymentFundsOutRepository.Setup(x => x.GetPaymentFundsOut(ExpectedAccountId)).ReturnsAsync(FundsOut);
            MockExpiredFundsRepository.Setup(x => x.Get(ExpectedAccountId)).ReturnsAsync(ExistingExpiredFunds);
            MockExpiredFunds.Setup(x => x.GetExpiringFunds(
                                       It.Is <Dictionary <CalendarPeriod, decimal> >(fi => AreFundsInEqual(FundsIn, fi)),
                                       It.Is <Dictionary <CalendarPeriod, decimal> >(fo => AreFundsOutEqual(FundsOut, fo)),
                                       It.Is <Dictionary <CalendarPeriod, decimal> >(ex => AreExpiredFundsEqual(ExistingExpiredFunds, ex)),
                                       FundsExpiryPeriod)).Returns(ExpiringFunds);

            Handler = new ExpireAccountFundsCommandHandler(MockCurrentDateTime.Object, MockLevyFundsInRepository.Object, MockPaymentFundsOutRepository.Object, MockExpiredFunds.Object, MockExpiredFundsRepository.Object, MockLogger.Object, EmployerFinanceConfiguration);
        }
 public ExpiredFundsRepository(EmployerFinanceConfiguration configuration, ILog logger, Lazy <EmployerFinanceDbContext> db)
     : base(configuration.DatabaseConnectionString, logger)
 {
     _db = db;
 }
Exemple #22
0
 public OwinAuthenticationService(EmployerFinanceConfiguration configuration, HttpContextBase httpContext)
 {
     _configuration = configuration;
     _httpContext   = httpContext;
 }
 public AccountLegalEntityRepository(EmployerFinanceConfiguration configuration, ILog logger, Lazy <EmployerFinanceDbContext> db)
     : base(configuration.DatabaseConnectionString, logger)
 {
     _db = db;
 }