public void SetUpOrganisationTests()
        {
            var databaseConnection = new SqlConnection(_databaseService.WebConfiguration.SqlConnectionString);
            var unitOfWork         = new UnitOfWork(databaseConnection);

            _validationRepository = new RegisterValidationRepository(unitOfWork);

            _organisationId1 = "EPA0088";
            _ukprn1          = 876533;
            _ukprn2          = 9888;

            _organisation1 = new OrganisationModel
            {
                Id                             = Guid.NewGuid(),
                CreatedAt                      = DateTime.Now.AddYears(-1).Date,
                DeletedAt                      = null,
                EndPointAssessorName           = "Name 1",
                EndPointAssessorOrganisationId = _organisationId1,
                EndPointAssessorUkprn          = _ukprn1,
                PrimaryContact                 = null,
                Status                         = "new",
                UpdatedAt                      = null,
                OrganisationTypeId             = null,
                OrganisationData               = null
            };

            _organisation2 = new OrganisationModel
            {
                Id                             = Guid.NewGuid(),
                CreatedAt                      = DateTime.Now.AddMonths(-1).Date,
                DeletedAt                      = null,
                EndPointAssessorName           = "Name 2",
                EndPointAssessorOrganisationId = "EPA0002",
                EndPointAssessorUkprn          = _ukprn2,
                PrimaryContact                 = null,
                Status                         = "new",
                UpdatedAt                      = null,
                OrganisationTypeId             = null,
                OrganisationData               = null
            };

            OrganisationHandler.InsertRecords(new List <OrganisationModel> {
                _organisation1, _organisation2
            });
        }
        public void SetupOrganisationTests()
        {
            _repository      = new RegisterQueryRepository(_databaseService.WebConfiguration);
            _organisationId1 = "EPA0001";
            _organisationId2 = "EPA005";
            _ukprn1          = 876544;
            _organisation1   = new OrganisationModel
            {
                Id                             = Guid.NewGuid(),
                CreatedAt                      = DateTime.Now.AddYears(-1).Date,
                DeletedAt                      = null,
                EndPointAssessorName           = "Name 1",
                EndPointAssessorOrganisationId = _organisationId1,
                EndPointAssessorUkprn          = _ukprn1,
                PrimaryContact                 = null,
                Status                         = "new",
                UpdatedAt                      = null,
                OrganisationTypeId             = null,
                OrganisationData               = null
            };

            _organisation2 = new OrganisationModel
            {
                Id                             = Guid.NewGuid(),
                CreatedAt                      = DateTime.Now.AddMonths(-1).Date,
                DeletedAt                      = null,
                EndPointAssessorName           = "Name 2",
                EndPointAssessorOrganisationId = _organisationId2,
                EndPointAssessorUkprn          = 9888,
                PrimaryContact                 = null,
                Status                         = "new",
                UpdatedAt                      = null,
                OrganisationTypeId             = null,
                OrganisationData               = null
            };

            OrganisationHandler.InsertRecords(new List <OrganisationModel> {
                _organisation1, _organisation2
            });
        }
Beispiel #3
0
        public void SetupOrganisationTests()
        {
            _repository      = new RegisterQueryRepository(_databaseService.WebConfiguration);
            _organisationId1 = "EPA00010";
            _organisationId2 = "EPA0050";
            _organisationId3 = "EPA0060";
            _organisationId4 = "EPA0075";
            _ukprn1          = 876544;
            _organisation1   = new OrganisationModel
            {
                Id                             = Guid.NewGuid(),
                CreatedAt                      = DateTime.Now.AddYears(-1).Date,
                DeletedAt                      = null,
                EndPointAssessorName           = "Name 1",
                EndPointAssessorOrganisationId = _organisationId1,
                EndPointAssessorUkprn          = _ukprn1,
                PrimaryContact                 = null,
                Status                         = "new",
                UpdatedAt                      = null,
                OrganisationTypeId             = null,
                OrganisationData               = null
            };

            _organisation2 = new OrganisationModel
            {
                Id                             = Guid.NewGuid(),
                CreatedAt                      = DateTime.Now.AddMonths(-1).Date,
                DeletedAt                      = null,
                EndPointAssessorName           = "Name 2",
                EndPointAssessorOrganisationId = _organisationId2,
                EndPointAssessorUkprn          = 9888,
                PrimaryContact                 = null,
                Status                         = "new",
                UpdatedAt                      = null,
                OrganisationTypeId             = null,
                OrganisationData               = null
            };

            _organisation3 = new OrganisationModel
            {
                Id                             = Guid.NewGuid(),
                CreatedAt                      = DateTime.Now.AddMonths(-1).Date,
                DeletedAt                      = null,
                EndPointAssessorName           = "companyNumber 3",
                EndPointAssessorOrganisationId = _organisationId3,
                EndPointAssessorUkprn          = 9888,
                PrimaryContact                 = null,
                Status                         = "new",
                UpdatedAt                      = null,
                OrganisationTypeId             = null,
                OrganisationData               = "{\"LegalName\":\"City and Guilds(London / ILM)\",\"CompanyNumber\":\"" + "companyNumber 3" + "\",\"CharityNumber\":\"10009931\"}"
            };

            _organisation4 = new OrganisationModel
            {
                Id                             = Guid.NewGuid(),
                CreatedAt                      = DateTime.Now.AddMonths(-1).Date,
                DeletedAt                      = null,
                EndPointAssessorName           = "companyNumber 4",
                EndPointAssessorOrganisationId = _organisationId4,
                EndPointAssessorUkprn          = 9888,
                PrimaryContact                 = null,
                Status                         = "new",
                UpdatedAt                      = null,
                OrganisationTypeId             = null,
                OrganisationData               = "{\"LegalName\":\"City and Guilds(London / ILM)\",\"CompanyNumber\":\"1234\",\"CharityNumber\":\"charity 4\"}"
            };

            OrganisationHandler.DeleteAllRecords();
            OrganisationHandler.InsertRecords(new List <OrganisationModel> {
                _organisation1, _organisation2, _organisation3, _organisation4
            });
        }
        public void SetupOrganisationTests()
        {
            _organisationIdCreated = "EPA0987";
            _repository            = new RegisterQueryRepository(_databaseService.WebConfiguration);
            _organisationId1       = "EPA0987";
            _organisation1         = new OrganisationModel
            {
                Id                             = Guid.NewGuid(),
                CreatedAt                      = DateTime.Now.AddYears(-1).Date,
                DeletedAt                      = null,
                EndPointAssessorName           = "Name 1",
                EndPointAssessorOrganisationId = _organisationId1,
                EndPointAssessorUkprn          = 876544,
                PrimaryContact                 = null,
                Status                         = "new",
                UpdatedAt                      = null,
                OrganisationTypeId             = null,
                OrganisationData               = null
            };

            _organisationStandard = new OrganisationStandardModel
            {
                Id = _orgStandardId,
                EndPointAssessorOrganisationId = _organisationIdCreated,
                StandardCode  = _standardCode,
                Status        = OrganisationStatus.New,
                EffectiveFrom = DateTime.Today.AddDays(-7),
                EffectiveTo   = DateTime.Today.AddDays(10),
                DateStandardApprovedOnRegister = DateTime.Today.AddDays(-50),
                Comments = "comments go here"
            };

            _deliveryArea1 = new DeliveryAreaModel {
                Id = 10, Status = "Live", Area = "North West"
            };
            _deliveryArea2 = new DeliveryAreaModel {
                Id = 20, Status = "New", Area = "Some Other"
            };
            var deliveryAreas = new List <DeliveryAreaModel> {
                _deliveryArea1, _deliveryArea2
            };

            DeliveryAreaHandler.InsertRecords(deliveryAreas);

            var deliveryArea1 = new OrganisationStandardDeliveryAreaModel {
                Id                     = _deliveryAreaId1,
                Comments               = "comments 1",
                DeliveryAreaId         = _deliveryArea1.Id,
                OrganisationStandardId = _orgStandardId,
                Status                 = OrganisationStatus.New,
            };

            var deliveryArea2 = new OrganisationStandardDeliveryAreaModel {
                Id                     = _deliveryAreaId2,
                Comments               = "comments 1",
                DeliveryAreaId         = _deliveryArea2.Id,
                OrganisationStandardId = _orgStandardId,
                Status                 = OrganisationStatus.New
            };

            OrganisationHandler.InsertRecords(new List <OrganisationModel> {
                _organisation1
            });
            OrganisationStandardHandler.InsertRecord(_organisationStandard);
            OrganisationStandardDeliveryAreaHandler.InsertRecords(new List <OrganisationStandardDeliveryAreaModel> {
                deliveryArea1, deliveryArea2
            });
        }
Beispiel #5
0
        public void ExpectedLatestDateIsReturnedWithUpdatedTakingPrecedence()
        {
            var organisations = new List <OrganisationModel>
            {
                new OrganisationModel
                {
                    UKPRN              = 23423,
                    ProviderTypeId     = 1,
                    OrganisationTypeId = 1,
                    StatusId           = OrganisationStatusHandler.Removed,
                    StatusDate         = DateTime.Today.AddDays(-10),
                    LegalName          = "Provider 1",
                    Id        = Guid.NewGuid(),
                    CreatedAt = DateTime.Now,
                    CreatedBy = "Test"
                },
                new OrganisationModel
                {
                    UKPRN              = 54675,
                    ProviderTypeId     = 2,
                    OrganisationTypeId = 2,
                    StatusId           = OrganisationStatusHandler.Active,
                    StatusDate         = DateTime.Today.AddDays(-10),
                    LegalName          = "Provider 2",
                    Id        = Guid.NewGuid(),
                    CreatedAt = DateTime.Now,
                    CreatedBy = "Test"
                },
                new OrganisationModel
                {
                    UKPRN              = 79878,
                    ProviderTypeId     = 3,
                    OrganisationTypeId = 3,
                    StatusId           = OrganisationStatusHandler.ActiveNotTakingOnApprentices,
                    StatusDate         = DateTime.Today.AddDays(-10),
                    LegalName          = "Provider 3",
                    Id        = Guid.NewGuid(),
                    CreatedAt = DateTime.Now,
                    CreatedBy = "Test"
                },
                new OrganisationModel
                {
                    UKPRN              = 3784,
                    ProviderTypeId     = 4,
                    OrganisationTypeId = 4,
                    StatusId           = OrganisationStatusHandler.Onboarding,
                    StatusDate         = DateTime.Today.AddDays(-10),
                    LegalName          = "Provider 4",
                    Id        = Guid.NewGuid(),
                    CreatedAt = DateTime.Now,
                    CreatedBy = "Test"
                }
            };

            OrganisationHandler.InsertRecords(organisations);

            var dataExportResult = _repository.GetFatDataExport().Result.ToList();

            dataExportResult.Count.Should().Be(organisations.Count);
            foreach (var organisation in organisations)
            {
                dataExportResult.Should().Contain(obj =>
                                                  obj.ToString().Contains(
                                                      $"UKPRN = '{organisation.UKPRN}', " +
                                                      $"StatusDate = '{organisation.StatusDate}', " +
                                                      $"StatusId = '{organisation.StatusId}', " +
                                                      $"OrganisationTypeId = '{organisation.OrganisationTypeId}', " +
                                                      $"ProviderTypeId = '{organisation.ProviderTypeId}'"));
            }
        }
        public void SetupOrganisationTests()
        {
            var databaseConnection = new SqlConnection(_databaseService.WebConfiguration.SqlConnectionString);
            var unitOfWork         = new UnitOfWork(databaseConnection);

            _repository = new RegisterQueryRepository(unitOfWork);

            _organisationIdCreated = "EPA0987";
            _organisationId1       = "EPA0987";
            _organisation1         = new OrganisationModel
            {
                Id                             = Guid.NewGuid(),
                CreatedAt                      = DateTime.Now.AddYears(-1).Date,
                DeletedAt                      = null,
                EndPointAssessorName           = "Name 1",
                EndPointAssessorOrganisationId = _organisationId1,
                EndPointAssessorUkprn          = 876544,
                PrimaryContact                 = null,
                Status                         = "new",
                UpdatedAt                      = null,
                OrganisationTypeId             = null,
                OrganisationData               = null
            };

            _organisationStandard = new OrganisationStandardModel
            {
                Id = _orgStandardId,
                EndPointAssessorOrganisationId = _organisationIdCreated,
                StandardCode  = _standardCode,
                Status        = OrganisationStatus.New,
                EffectiveFrom = DateTime.Today.AddDays(-7),
                EffectiveTo   = DateTime.Today.AddDays(10),
                DateStandardApprovedOnRegister = DateTime.Today.AddDays(-50),
                Comments = "comments go here"
            };

            _deliveryArea1 = new DeliveryAreaModel {
                Id = 10, Status = "Live", Area = "North West"
            };
            _deliveryArea2 = new DeliveryAreaModel {
                Id = 20, Status = "New", Area = "Some Other"
            };
            var deliveryAreas = new List <DeliveryAreaModel> {
                _deliveryArea1, _deliveryArea2
            };

            DeliveryAreaHandler.InsertRecords(deliveryAreas);

            var deliveryArea1 = new OrganisationStandardDeliveryAreaModel
            {
                Id                     = _deliveryAreaId1,
                Comments               = "comments 1",
                DeliveryAreaId         = _deliveryArea1.Id,
                OrganisationStandardId = _orgStandardId,
                Status                 = OrganisationStatus.New,
            };

            var deliveryArea2 = new OrganisationStandardDeliveryAreaModel
            {
                Id                     = _deliveryAreaId2,
                Comments               = "comments 1",
                DeliveryAreaId         = _deliveryArea2.Id,
                OrganisationStandardId = _orgStandardId,
                Status                 = OrganisationStatus.New
            };

            var organistionStandardVersion1 = new OrganisationStandardVersionModel
            {
                OrganisationStandardId = _orgStandardId,
                StandardUId            = _standardUID1,
                EffectiveFrom          = DateTime.Now.AddMonths(-12),
                EffectiveTo            = DateTime.Now.AddMonths(-3),
                Version             = "1.0",
                DateVersionApproved = DateTime.Now.AddMonths(-12),
                Status = "Live"
            };

            var organistionStandardVersion2 = new OrganisationStandardVersionModel
            {
                OrganisationStandardId = _orgStandardId,
                StandardUId            = _standardUID2,
                EffectiveFrom          = DateTime.Now.AddMonths(-3),
                EffectiveTo            = null,
                Version             = "1.1",
                DateVersionApproved = DateTime.Now.AddMonths(-3),
                Status = "Live"
            };

            var standardModel1 = new StandardModel
            {
                StandardUId          = _standardUID1,
                IFateReferenceNumber = "ST0001",
                Version            = "1.0",
                Title              = "Standard",
                Level              = 4,
                Status             = "Approved for Delivery",
                TypicalDuration    = 12,
                TrailblazerContact = "Contact name",
                StandardPageUrl    = "www.standard.com",
                OverviewOfRole     = "Explanation of apprenticeship job role"
            };

            var standardModel2 = new StandardModel
            {
                StandardUId          = _standardUID2,
                IFateReferenceNumber = "ST0001",
                Version            = "1.1",
                Title              = "Standard",
                Level              = 4,
                Status             = "Approved for Delivery",
                TypicalDuration    = 12,
                TrailblazerContact = "Contact name",
                StandardPageUrl    = "www.standard.com",
                OverviewOfRole     = "Explanation of apprenticeship job role"
            };

            OrganisationHandler.InsertRecords(new List <OrganisationModel> {
                _organisation1
            });
            OrganisationStandardHandler.InsertRecord(_organisationStandard);
            OrganisationStandardDeliveryAreaHandler.InsertRecords(new List <OrganisationStandardDeliveryAreaModel> {
                deliveryArea1, deliveryArea2
            });
            OrganisationStandardVersionHandler.InsertRecord(organistionStandardVersion1);
            OrganisationStandardVersionHandler.InsertRecord(organistionStandardVersion2);

            StandardsHandler.InsertRecords(new List <StandardModel> {
                standardModel1, standardModel2
            });
        }
        public async Task SetupCertificateTests()
        {
            var option = new DbContextOptionsBuilder <AssessorDbContext>();

            option.UseSqlServer(_databaseService.WebConfiguration.SqlConnectionString, options => options.EnableRetryOnFailure(3));

            _context    = new AssessorDbContext(option.Options);
            _unitOfWork = new UnitOfWork(new SqlConnection(_databaseService.WebConfiguration.SqlConnectionString));

            _repository = new CertificateRepository(_unitOfWork, _context);

            OrganisationTypeHandler.InsertRecord(
                new OrganisationTypeModel
            {
                Id     = _organisationTypeId,
                Status = "Live",
                Type   = "Organisation Type A"
            });

            _organisation = new OrganisationModel
            {
                Id                             = _organisationId,
                CreatedAt                      = DateTime.Now,
                EndPointAssessorName           = "Epao Name 1",
                EndPointAssessorOrganisationId = "EPA0200",
                EndPointAssessorUkprn          = 1234567890,
                PrimaryContact                 = null,
                OrganisationTypeId             = _organisationTypeId,
                OrganisationData               = null,
                Status                         = OrganisationStatus.New
            };

            OrganisationHandler.InsertRecords(
                new List <OrganisationModel>()
            {
                _organisation
            });

            var certData = new CertificateData()
            {
                LearnerGivenNames       = "Test",
                LearnerFamilyName       = "Person",
                LearningStartDate       = DateTime.Now,
                StandardReference       = "ST0100",
                StandardName            = "Software Tester",
                StandardLevel           = 1,
                StandardPublicationDate = DateTime.Now.AddDays(-356),
                FullName     = $"Test Person",
                ProviderName = _organisation.EndPointAssessorName,
                EpaDetails   = new EpaDetails {
                    Epas = new List <EpaRecord>()
                }
            };

            var certificate = new Certificate()
            {
                Uln                  = 123456789,
                StandardCode         = 1,
                ProviderUkPrn        = _organisation.EndPointAssessorUkprn.Value,
                OrganisationId       = _organisation.Id,
                CreatedBy            = "Tester",
                CertificateData      = JsonConvert.SerializeObject(certData),
                Status               = CertificateStatus.Draft,
                CertificateReference = string.Empty,
                LearnRefNumber       = "1234567890",
                CreateDay            = DateTime.UtcNow.Date,
                IsPrivatelyFunded    = true
            };

            _createdCertificate = await _repository.NewPrivate(certificate, "EPA0200");
        }