예제 #1
0
        public async Task SetupDatabase()
        {
            var container = new Container(c =>
            {
                c.AddRegistry <DAS.Data.Functions.Ioc.DefaultRegistry>();
            });

            Mediator             = container.GetInstance <IMediator>();
            StatisticsRepository = container.GetInstance <IStatisticsRepository>();

            Log = new NLogLogger(typeof(StatisticsService));
            EasStatisticsHandlerMock         = new Mock <IEasStatisticsHandler>();
            CommitmentsStatisticsHandlerMock = new Mock <ICommitmentsStatisticsHandler>();
            PaymentsStatisticsHandlerMock    = new Mock <IPaymentStatisticsHandler>();

            StatisticsService = new StatisticsService(Log, EasStatisticsHandlerMock.Object, StatisticsRepository,
                                                      Mediator, CommitmentsStatisticsHandlerMock.Object, PaymentsStatisticsHandlerMock.Object);

            StatisticsTestsRepository = new StatisticsTestsRepository(DataAcceptanceTests.Config.DatabaseConnectionString);
            await StatisticsTestsRepository.DeleteConsistencyChecks();

            await StatisticsTestsRepository.DeletePayments();

            await StatisticsTestsRepository.InsertPaymentsData(new PaymentsRecord
            {
                UpdateDateTime = DateTime.Now
            });
        }
예제 #2
0
        public async Task SetupDatabase()
        {
            var container = new Container(c =>
            {
                c.AddRegistry <DAS.Data.Functions.Ioc.DefaultRegistry>();
            });

            Mediator             = container.GetInstance <IMediator>();
            StatisticsRepository = container.GetInstance <IStatisticsRepository>();

            Log = new NLogLogger(typeof(StatisticsService), null);
            EasStatisticsHandlerMock         = new Mock <IEasStatisticsHandler>();
            CommitmentsStatisticsHandlerMock = new Mock <ICommitmentsStatisticsHandler>();
            PaymentsStatisticsHandlerMock    = new Mock <IPaymentStatisticsHandler>();

            StatisticsService = new StatisticsService(Log, EasStatisticsHandlerMock.Object,
                                                      StatisticsRepository, Mediator,
                                                      CommitmentsStatisticsHandlerMock.Object, PaymentsStatisticsHandlerMock.Object);

            StatisticsTestsRepository = new StatisticsTestsRepository(DataAcceptanceTests.Config.DatabaseConnectionString);
            await StatisticsTestsRepository.DeleteConsistencyChecks();

            await StatisticsTestsRepository.DeleteCommitments();

            await StatisticsTestsRepository.InsertCommitmentsData(new CommitmentsRecord
            {
                CommitmentID         = 123, PaymentStatus = "Active", ApprenticeshipID = 123, AgreementStatus = "Agreed",
                ProviderID           = "ABC", LearnerID = "ABC", EmployerAccountID = "ABC", TrainingTypeID = "ABC", TrainingID = "ABC",
                TrainingStartDate    = DateTime.Now, TrainingEndDate = DateTime.Now, TrainingTotalCost = new decimal(123.12), UpdateDateTime = DateTime.Now,
                LegalEntityCode      = "ABC", LegalEntityName = "ABC", LegalEntityOrganisationType = "ABC", DateOfBirth = DateTime.Now, IsLatest = true, TransferSenderAccountId = null,
                TransferApprovalDate = DateTime.Now, TransferApprovalStatus = "ABC"
            });
        }
예제 #3
0
        public async Task SetupDatabase()
        {
            var container = new Container(c =>
            {
                c.AddRegistry <DAS.Data.Functions.Ioc.DefaultRegistry>();
            });

            Mediator             = container.GetInstance <IMediator>();
            StatisticsRepository = container.GetInstance <IStatisticsRepository>();

            Log = new NLogLogger(typeof(StatisticsService), null);
            EasStatisticsHandlerMock         = new Mock <IEasStatisticsHandler>();
            CommitmentsStatisticsHandlerMock = new Mock <ICommitmentsStatisticsHandler>();
            PaymentsStatisticsHandlerMock    = new Mock <IPaymentStatisticsHandler>();

            StatisticsService = new StatisticsService(Log, EasStatisticsHandlerMock.Object,
                                                      StatisticsRepository, Mediator,
                                                      CommitmentsStatisticsHandlerMock.Object, PaymentsStatisticsHandlerMock.Object);

            StatisticsTestsRepository = new StatisticsTestsRepository(DataAcceptanceTests.Config.DatabaseConnectionString);
            await StatisticsTestsRepository.DeleteConsistencyChecks();

            await StatisticsTestsRepository.DeleteEmployerAccounts();

            await StatisticsTestsRepository.DeleteEmployerAgreements();

            await StatisticsTestsRepository.DeleteEmployerLegalEntities();

            await StatisticsTestsRepository.DeletePayments();

            await StatisticsTestsRepository.DeleteEmployerPayeSchemes();

            await StatisticsTestsRepository.InsertPaymentsData(new PaymentsRecord
            {
                CollectionYear = DateTime.Now.Year,  //Hima - Changed from 2018 to DateTime.Now.Year
                UpdateDateTime = DateTime.Now
            });

            await StatisticsTestsRepository.InsertEmployerPayeSchemes(new EmployerPayeSchemesRecord()
            {
                DasAccountId = "123", Ref = "123", AddedDate = DateTime.Now, UpdateDateTime = DateTime.Now, IsLatest = true
            });

            await StatisticsTestsRepository.InsertEmployerAccountsData(new EmployerAccountsRecord
            {
                DasAccountId = "123", AccountName = "abc", DateRegistered = DateTime.Now, OwnerEmail = "memecom", UpdateDateTime = DateTime.Now, AccountId = 123, IsLatest = true
            });

            await StatisticsTestsRepository.InsertEmployerLegalEntities(new EmployerLegalEntitiesRecord
            {
                DasAccountId = "123", DasLegalEntityId = 123, Status = "active", UpdateDateTime = DateTime.Now, IsLatest = true, Name = "abc", Source = "abc"
            });

            await StatisticsTestsRepository.InsertEmployerAgreements(new EmployerAgreementsRecord()
            {
                DasAccountId = "123", Status = "signed", DasLegalEntityId = 123, DasAgreementId = "123", UpdateDateTime = DateTime.Now, IsLatest = true
            });
        }
        private async Task <bool> IsDatabaseInExpectedState()
        {
            var commitmentsStatisticsCount = await StatisticsTestsRepository.GetNumberOfLatestActiveApprenticeships();

            commitmentsStatisticsCount += await StatisticsTestsRepository.GetNumberOfLatestTotalApprenticeships();

            commitmentsStatisticsCount += await StatisticsTestsRepository.GetNumberOfLatestTotalCohorts();

            return(commitmentsStatisticsCount == 3);
        }
예제 #5
0
        private async Task <bool> IsDatabaseInExpectedState()
        {
            var accountsStatisticsCount = await StatisticsTestsRepository.GetNumberOfTotalAccounts();

            accountsStatisticsCount += await StatisticsTestsRepository.GetNumberOfTotalPayments();

            accountsStatisticsCount += await StatisticsTestsRepository.GetNumberOfTotalAgreements();

            accountsStatisticsCount += await StatisticsTestsRepository.GetNumberOfTotalLegalEntities();

            accountsStatisticsCount += await StatisticsTestsRepository.GetNumberOfTotalPayeSchemes();

            return(accountsStatisticsCount == 5);
        }
예제 #6
0
        private async Task <bool> IsDatabaseInExpectedState()
        {
            var paymentsStatisticsCount = await StatisticsTestsRepository.GetNumberOfProviderTotalPayments();

            return(paymentsStatisticsCount == 1);
        }