public void Then_an_exception_is_not_thrown()
        {
            RegisterQueryRepository.Setup(c => c.GetAllOrganisationStandardByOrganisationId("EPA0050"))
            .ReturnsAsync(new List <OrganisationStandardSummary>
            {
                new OrganisationStandardSummary {
                    StandardCode = 12
                },
                new OrganisationStandardSummary {
                    StandardCode = 13
                },
                new OrganisationStandardSummary {
                    StandardCode = 14
                }
            });

            CertificateRepository.Setup(c => c.GetDraftAndCompletedCertificatesFor(It.IsAny <long>()))
            .ReturnsAsync(new List <Certificate>());

            SearchHandler
            .Handle(new SearchQuery()
            {
                Surname = "smith", EpaOrgId = "99999", Uln = 12345, Username = "******"
            },
                    new CancellationToken()).Wait();
        }
Ejemplo n.º 2
0
        public void SetupDeliveryAreasTests()
        {
            _repository    = new RegisterQueryRepository(_databaseService.WebConfiguration);
            _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);
        }
        public void SetupOrganisationTypesTests()
        {
            _repository        = new RegisterQueryRepository(_databaseService.WebConfiguration);
            _organisationType1 = new OrganisationTypeModel {
                Id = 10, Status = "Live", Type = "Award Organisation"
            };
            _organisationType2 = new OrganisationTypeModel {
                Id = 20, Status = "New", Type = "Some Other"
            };
            var organisationTypes = new List <OrganisationTypeModel> {
                _organisationType1, _organisationType2
            };

            OrganisationTypeHandler.InsertRecords(organisationTypes);
        }
Ejemplo n.º 4
0
        public void SetUpOrganisationTests()
        {
            _repository            = new RegisterRepository(_databaseService.WebConfiguration, new Mock <ILogger <RegisterRepository> >().Object);
            _validationRepository  = new RegisterValidationRepository(_databaseService.WebConfiguration);
            _queryRepository       = new RegisterQueryRepository(_databaseService.WebConfiguration);
            _organisationIdCreated = "EPA0987";
            _ukprnCreated          = 123321;
            var org2IdCreated = "EPA0001";

            _organisationTypeId = 5;
            OrganisationTypeHandler.InsertRecord(new OrganisationTypeModel {
                Id = _organisationTypeId, Status = "new", Type = "organisation type 1"
            });
            _id = Guid.NewGuid();

            _organisation = new EpaOrganisation
            {
                Id                 = _id,
                CreatedAt          = DateTime.Now,
                Name               = "name 2",
                OrganisationId     = _organisationIdCreated,
                Ukprn              = _ukprnCreated,
                PrimaryContact     = null,
                PrimaryContactName = null,
                Status             = OrganisationStatus.New,
                OrganisationTypeId = _organisationTypeId,
                OrganisationData   = new OrganisationData
                {
                    LegalName   = " legal name",
                    TradingName = "trading name",
                    Address1    = "address 1",
                    Address2    = "address 2",
                    Address3    = "address 3",
                    Address4    = "address 4",
                    Postcode    = "postcode"
                }
            };

            _organisation2 = new EpaOrganisation
            {
                Id                 = Guid.NewGuid(),
                Name               = "name 1",
                OrganisationId     = org2IdCreated,
                Status             = OrganisationStatus.New,
                OrganisationTypeId = null
            };
        }
        public void SetupOrganisationTests()
        {
            var databaseConnection = new SqlConnection(_databaseService.WebConfiguration.SqlConnectionString);
            var unitOfWork         = new UnitOfWork(databaseConnection);

            _repository = new RegisterQueryRepository(unitOfWork);

            _organisationId1 = "EPA0300";
            _organisationId2 = "EPA0005";
            _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
            });
        }
Ejemplo n.º 6
0
        public void SetupDeliveryAreasTests()
        {
            var databaseConnection = new SqlConnection(_databaseService.WebConfiguration.SqlConnectionString);
            var unitOfWork         = new UnitOfWork(databaseConnection);

            _repository = new RegisterQueryRepository(unitOfWork);

            _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);
        }
Ejemplo n.º 7
0
        public void SetupOrganisationTypesTests()
        {
            var databaseConnection = new SqlConnection(_databaseService.WebConfiguration.SqlConnectionString);
            var unitOfWork         = new UnitOfWork(databaseConnection);

            _repository = new RegisterQueryRepository(unitOfWork);

            _organisationType1 = new OrganisationTypeModel {
                Id = 20, Status = "Live", Type = "Award Organisation"
            };
            _organisationType2 = new OrganisationTypeModel {
                Id = 21, Status = "New", Type = "Some Other"
            };
            var organisationTypes = new List <OrganisationTypeModel> {
                _organisationType1, _organisationType2
            };

            OrganisationTypeHandler.InsertRecords(organisationTypes);
        }
Ejemplo n.º 8
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
            });
        }
        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
            });
        }