Beispiel #1
0
 public void Before_the_tests()
 {
     _organisationTypeId1 = 1;
     _repository          = new OrganisationRepository(_databaseService.WebConfiguration);
     _statusActive        = new OrganisationStatusModel {
         Id = _organisationStatusIdActive, Status = "Live", CreatedAt = DateTime.Now, CreatedBy = "TestSystem"
     };
     _statusOnboarding = new OrganisationStatusModel {
         Id = _organisationStatusIdOnboarding, Status = "Live", CreatedAt = DateTime.Now, CreatedBy = "TestSystem"
     };
     OrganisationStatusHandler.InsertRecord(_statusActive);
     OrganisationStatusHandler.InsertRecord(_statusOnboarding);
     _providerType1 = new ProviderTypeModel {
         Id = _providerTypeIdMainProvider, ProviderType = "Main Provider", Description = "provider type description 1", CreatedAt = DateTime.Now, CreatedBy = "TestSystem", Status = "Live"
     };
     _providerType2 = new ProviderTypeModel {
         Id = _providerTypeIdEmployerProvider, ProviderType = "Employer Provider", Description = "provider type description 2", CreatedAt = DateTime.Now, CreatedBy = "TestSystem", Status = "Live"
     };
     _providerType3 = new ProviderTypeModel {
         Id = _providerTypeIdSupportingProvider, ProviderType = "Supporting Provider", Description = "provider type description 3", CreatedAt = DateTime.Now, CreatedBy = "TestSystem", Status = "Live"
     };
     ProviderTypeHandler.InsertRecords(new List <ProviderTypeModel> {
         _providerType1, _providerType2, _providerType3
     });
     _organisationTypeModel1 = new OrganisationTypeModel {
         Id = _organisationTypeId1, Type = "organisation type 10", Description = "organisation type description", CreatedAt = DateTime.Now, CreatedBy = "TestSystem", Status = "Live"
     };
     OrganisationTypeHandler.InsertRecord(_organisationTypeModel1);
 }
 public void setup_organisation_subtables_are_added()
 {
     _providerTypeId1     = 10;
     _organisationTypeId1 = 100;
     _organisationUkprn   = 11114433;
     _organisationUkprn2  = 11114432;
     _legalName           = "Legal name 1";
     _organisationId      = Guid.NewGuid();
     _organisationId2     = Guid.NewGuid();
     _repository          = new DownloadRegisterRepository(_databaseService.DbConnectionHelper);
     OrganisationStatusHandler.InsertRecords(
         new List <OrganisationStatusModel>
     {
         new OrganisationStatusModel {
             Id = OrganisationStatusHandler.Active, Status = "Active", CreatedAt = DateTime.Now, CreatedBy = "TestSystem"
         },
         new OrganisationStatusModel {
             Id = OrganisationStatusHandler.Removed, Status = "Removed", CreatedAt = DateTime.Now, CreatedBy = "TestSystem"
         },
         new OrganisationStatusModel {
             Id = OrganisationStatusHandler.ActiveNotTakingOnApprentices, Status = "Active - but not taking on apprentices", CreatedAt = DateTime.Now, CreatedBy = "TestSystem"
         },
         new OrganisationStatusModel {
             Id = OrganisationStatusHandler.Onboarding, Status = "On-boarding", CreatedAt = DateTime.Now, CreatedBy = "TestSystem"
         }
     });
     _providerType1 = new ProviderTypeModel {
         Id = _providerTypeId1, ProviderType = "provider type 10", Description = "provider type description", CreatedAt = DateTime.Now, CreatedBy = "TestSystem", Status = "Live"
     };
     ProviderTypeHandler.InsertRecord(_providerType1);
     _organisationTypeModel1 = new OrganisationTypeModel {
         Id = _organisationTypeId1, Type = "organisation type 10", Description = "organisation type description", CreatedAt = DateTime.Now, CreatedBy = "TestSystem", Status = "Live"
     };
     OrganisationTypeHandler.InsertRecord(_organisationTypeModel1);
 }
Beispiel #3
0
 public void setup_organisation_is_added()
 {
     _organisationStatusId1 = 1;
     _providerTypeId1       = 10;
     _organisationTypeId1   = 100;
     _organisationUkprn     = 11114433;
     _legalName             = "Legal name 1";
     _organisationId        = Guid.NewGuid();
     _repository            = new OrganisationRepository(_databaseService.WebConfiguration);
     _status1 = new OrganisationStatusModel {
         Id = _organisationStatusId1, Status = "Live", CreatedAt = DateTime.Now, CreatedBy = "TestSystem"
     };
     OrganisationStatusHandler.InsertRecord(_status1);
     _providerType1 = new ProviderTypeModel {
         Id = _providerTypeId1, ProviderType = "provider type 10", Description = "provider type description", CreatedAt = DateTime.Now, CreatedBy = "TestSystem", Status = "Live"
     };
     ProviderTypeHandler.InsertRecord(_providerType1);
     _organisationTypeModel1 = new OrganisationTypeModel {
         Id = _organisationTypeId1, Type = "organisation type 10", Description = "organisation type description", CreatedAt = DateTime.Now, CreatedBy = "TestSystem", Status = "Live"
     };
     OrganisationTypeHandler.InsertRecord(_organisationTypeModel1);
     _organisation = new OrganisationModel
     {
         UKPRN = _organisationUkprn,
         OrganisationTypeId = _organisationTypeId1,
         ProviderTypeId     = _providerTypeId1,
         StatusId           = _organisationStatusId1,
         StatusDate         = DateTime.Today.AddDays(5),
         LegalName          = _legalName,
         Id        = _organisationId,
         CreatedAt = DateTime.Now,
         CreatedBy = "Test"
     };
     OrganisationHandler.InsertRecord(_organisation);
 }
Beispiel #4
0
        public void SetUpOrganisationTests()
        {
            var databaseConnection = new SqlConnection(_databaseService.WebConfiguration.SqlConnectionString);
            var unitOfWork         = new UnitOfWork(databaseConnection);

            _repository           = new RegisterRepository(unitOfWork, new Mock <ILogger <RegisterRepository> >().Object);
            _validationRepository = new RegisterValidationRepository(unitOfWork);

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

            _organisation = new OrganisationModel
            {
                Id                             = _id,
                CreatedAt                      = DateTime.Now,
                EndPointAssessorName           = "name 2",
                EndPointAssessorOrganisationId = _organisationIdCreated,
                EndPointAssessorUkprn          = _ukprnCreated,
                PrimaryContact                 = null,
                OrganisationTypeId             = _organisationTypeId,
                OrganisationData               = null,
                Status                         = OrganisationStatus.New
            };

            _organisation2 = new OrganisationModel
            {
                Id                             = Guid.NewGuid(),
                CreatedAt                      = DateTime.Now,
                EndPointAssessorName           = "name 1",
                EndPointAssessorOrganisationId = _org2IdCreated,
                OrganisationTypeId             = null,
                Status                         = OrganisationStatus.New
            };

            _username = "******";
            OrganisationHandler.InsertRecord(_organisation);
            OrganisationHandler.InsertRecord(_organisation2);

            _contactId = Guid.NewGuid();

            _contact = new EpaContact
            {
                Id = _contactId,
                EndPointAssessorOrganisationId = _organisationIdCreated,
                Username    = _username,
                DisplayName = "Joe Cool",
                Email       = "*****@*****.**",
                PhoneNumber = "555 55555",
                Status      = OrganisationStatus.New,
                SigninType  = "",
                FirstName   = "zzz",
                LastName    = "Ftagn"
            };
        }
 public void Tear_down()
 {
     OrganisationCategoryOrgTypeProviderTypeHandler.DeleteAllRecords();
     OrganisationCategoryHandler.DeleteAllRecords();
     ProviderTypeHandler.DeleteAllRecords();
     OrganisationTypeHandler.DeleteAllRecords();
 }
Beispiel #6
0
 public void TearDownOrganisationTests()
 {
     OrganisationContactHandler.DeleteRecordByUserName(_username);
     OrganisationHandler.DeleteRecordByEndPointAssessorOrganisationId(_organisationIdCreated);
     OrganisationHandler.DeleteRecordByEndPointAssessorOrganisationId(_org2IdCreated);
     OrganisationTypeHandler.DeleteRecord(_organisationTypeId);
 }
 public void tear_down()
 {
     OrganisationHandler.DeleteAllRecords();
     OrganisationTypeHandler.DeleteRecord(_organisationTypeId1);
     ProviderTypeHandler.DeleteAllRecords();
     OrganisationStatusHandler.DeleteAllRecords();
 }
 public void TearDownCertificateTests()
 {
     CertificateLogsHandler.DeleteRecord(_createdCertificate.Id);
     CertificateHandler.DeleteRecord(_createdCertificate.Id);
     OrganisationHandler.DeleteRecordByEndPointAssessorOrganisationId("EPA0200");
     OrganisationTypeHandler.DeleteRecord(_organisationTypeId);
 }
        public void Set_up_and_run_update()
        {
            _organisationStatusId1        = 1;
            _organisationStatusId0        = 0;
            _providerTypeId1              = 10;
            _organisationTypeId1          = 100;
            _organisationUkprn            = 11114433;
            _legalName                    = "Legal name 1";
            _organisationId               = Guid.NewGuid();
            _updateOrganisationRepository = new UpdateOrganisationRepository(_databaseService.DbConnectionHelper);
            _repository                   = new OrganisationRepository(_databaseService.DbConnectionHelper);
            _status1 = new OrganisationStatusModel {
                Id = _organisationStatusId1, Status = "Live", CreatedAt = DateTime.Now, CreatedBy = "TestSystem"
            };
            OrganisationStatusHandler.InsertRecord(_status1);
            _status2 = new OrganisationStatusModel {
                Id = _organisationStatusId0, Status = "Live", CreatedAt = DateTime.Now, CreatedBy = "TestSystem"
            };
            OrganisationStatusHandler.InsertRecord(_status2);
            _reason1 = new RemovedReasonModel {
                Id = 1, CreatedBy = "System", Reason = "Test reason", Status = "Live"
            };
            RemovedReasonHandler.InsertRecord(_reason1);
            _reason2 = new RemovedReasonModel {
                Id = 2, CreatedBy = "System", Reason = "Test reason 2", Status = "Live"
            };
            RemovedReasonHandler.InsertRecord(_reason2);
            _providerType1 = new ProviderTypeModel {
                Id = _providerTypeId1, ProviderType = "provider type 10", Description = "provider type description", CreatedAt = DateTime.Now, CreatedBy = "TestSystem", Status = "Live"
            };
            ProviderTypeHandler.InsertRecord(_providerType1);
            _organisationTypeModel1 = new OrganisationTypeModel {
                Id = _organisationTypeId1, Type = "organisation type 10", Description = "organisation type description", CreatedAt = DateTime.Now, CreatedBy = "TestSystem", Status = "Live"
            };
            OrganisationTypeHandler.InsertRecord(_organisationTypeModel1);
            var json = "{ \"CompanyNumber\":\"12345678\",\"CharityNumber\":\"1234567\",\"ParentCompanyGuarantee\":false,\"FinancialTrackRecord\":true,\"NonLevyContract\":false,\"StartDate\":\"2019-03-27 00:00:00\",\"RemovedReason\":{\"Id\":1,\"Reason\":\"Test reason\",\"Description\":null,\"CreatedBy\":\"System\",\"CreatedAt\":\"2019-02-11 15:47:23\",\"UpdatedBy\":null,\"UpdatedAt\":null,\"Status\":\"Live\"}}";

            _organisation = new OrganisationModel
            {
                UKPRN = _organisationUkprn,
                OrganisationTypeId = _organisationTypeId1,
                ProviderTypeId     = _providerTypeId1,
                StatusId           = _organisationStatusId1,
                StatusDate         = DateTime.Today.AddDays(5),
                LegalName          = _legalName,
                Id               = _organisationId,
                CreatedAt        = DateTime.Now,
                CreatedBy        = "Test",
                OrganisationData = json
            };
            OrganisationHandler.InsertRecord(_organisation);
            _changedBy = "SystemChange";

            var _updatedReason = _updateOrganisationRepository.UpdateStatusWithRemovedReason(_organisationId, _organisationStatusId0, _reason2.Id, _changedBy).Result;

            _successfulUpdate        = (_updatedReason != null);
            _newOrganisationStatusId = _repository.GetOrganisationStatus(_organisationId).Result;
        }
Beispiel #10
0
 public void Tear_down()
 {
     OrganisationHandler.DeleteAllRecords();
     OrganisationTypeHandler.DeleteRecord(_organisationTypeId1);
     ProviderTypeHandler.DeleteAllRecords();
     OrganisationStatusHandler.DeleteRecords(new List <int> {
         _status1.Id
     });
 }
        public void Before_the_tests()
        {
            _lookupRepository = new LookupDataRepository(_databaseService.WebConfiguration, _cacheHelper);
            _providerTypeId1  = 1;
            _providerTypeId2  = 2;
            _organisationTypeId1WithProviderTypeId1CategoryId1 = 10;
            _organisationTypeId2WithProviderTypeId1CategoryId1 = 20;
            _organisationTypeId3WithProviderTypeId1CategoryId1 = 30;
            _organisationTypeId3WithProviderTypeId2CategoryId1 = 40;
            _organisationTypeId4WithProviderTypeId2            = 100;
            _cacheHelper.PurgeAllCaches();
            _categoryId1 = 1;
            _categoryId2 = 2;

            OrganisationTypeHandler.InsertRecord(new OrganisationTypeModel {
                Id = _organisationTypeId1WithProviderTypeId1CategoryId1, CreatedAt = DateTime.Now, CreatedBy = "system", Status = "x", Type = "a"
            });
            OrganisationTypeHandler.InsertRecord(new OrganisationTypeModel {
                Id = _organisationTypeId2WithProviderTypeId1CategoryId1, CreatedAt = DateTime.Now, CreatedBy = "system", Status = "x", Type = "b"
            });
            OrganisationTypeHandler.InsertRecord(new OrganisationTypeModel {
                Id = _organisationTypeId3WithProviderTypeId1CategoryId1, CreatedAt = DateTime.Now, CreatedBy = "system", Status = "x", Type = "c"
            });
            OrganisationTypeHandler.InsertRecord(new OrganisationTypeModel {
                Id = _organisationTypeId3WithProviderTypeId2CategoryId1, CreatedAt = DateTime.Now, CreatedBy = "system", Status = "x", Type = "c"
            });
            OrganisationTypeHandler.InsertRecord(new OrganisationTypeModel {
                Id = _organisationTypeId4WithProviderTypeId2, CreatedAt = DateTime.Now, CreatedBy = "system", Status = "x", Type = "d"
            });
            ProviderTypeHandler.InsertRecord(new ProviderTypeModel {
                Id = _providerTypeId1, CreatedAt = DateTime.Now, CreatedBy = "system", Status = "x", ProviderType = "a"
            });
            ProviderTypeHandler.InsertRecord(new ProviderTypeModel {
                Id = _providerTypeId2, CreatedAt = DateTime.Now, CreatedBy = "system", Status = "x", ProviderType = "b"
            });
            OrganisationCategoryHandler.InsertRecord(new OrganisationCategoryModel {
                Id = _categoryId1, Category = "category 1", CreatedAt = DateTime.Now, CreatedBy = "system", Status = "x"
            });
            OrganisationCategoryHandler.InsertRecord(new OrganisationCategoryModel {
                Id = _categoryId2, Category = "category 2", CreatedAt = DateTime.Now, CreatedBy = "system", Status = "x"
            });
            OrganisationCategoryOrgTypeProviderTypeHandler.InsertRecord(new OrganisationCategoryOrgTypeProviderTypeModel {
                Id = 1, OrganisationTypeId = _organisationTypeId1WithProviderTypeId1CategoryId1, ProviderTypeId = _providerTypeId1, OrganisationCategoryId = _categoryId1, CreatedAt = DateTime.Now, CreatedBy = "system", Status = "x"
            });
            OrganisationCategoryOrgTypeProviderTypeHandler.InsertRecord(new OrganisationCategoryOrgTypeProviderTypeModel {
                Id = 2, OrganisationTypeId = _organisationTypeId2WithProviderTypeId1CategoryId1, ProviderTypeId = _providerTypeId1, OrganisationCategoryId = _categoryId1, CreatedAt = DateTime.Now, CreatedBy = "system", Status = "x"
            });
            OrganisationCategoryOrgTypeProviderTypeHandler.InsertRecord(new OrganisationCategoryOrgTypeProviderTypeModel {
                Id = 3, OrganisationTypeId = _organisationTypeId3WithProviderTypeId1CategoryId1, ProviderTypeId = _providerTypeId1, OrganisationCategoryId = _categoryId1, CreatedAt = DateTime.Now, CreatedBy = "system", Status = "x"
            });
            OrganisationCategoryOrgTypeProviderTypeHandler.InsertRecord(new OrganisationCategoryOrgTypeProviderTypeModel {
                Id = 4, OrganisationTypeId = _organisationTypeId3WithProviderTypeId2CategoryId1, ProviderTypeId = _providerTypeId2, OrganisationCategoryId = _categoryId1, CreatedAt = DateTime.Now, CreatedBy = "system", Status = "x"
            });
        }
Beispiel #12
0
        public void setup()
        {
            OrganisationStatusHandler.InsertRecords(
                new List <OrganisationStatusModel>
            {
                new OrganisationStatusModel {
                    Id = OrganisationStatusHandler.Active, Status = "Active", CreatedAt = DateTime.Now, CreatedBy = "TestSystem"
                },
                new OrganisationStatusModel {
                    Id = OrganisationStatusHandler.Removed, Status = "Removed", CreatedAt = DateTime.Now, CreatedBy = "TestSystem"
                },
                new OrganisationStatusModel {
                    Id = OrganisationStatusHandler.ActiveNotTakingOnApprentices, Status = "Active - but not taking on apprentices", CreatedAt = DateTime.Now, CreatedBy = "TestSystem"
                },
                new OrganisationStatusModel {
                    Id = OrganisationStatusHandler.Onboarding, Status = "On-boarding", CreatedAt = DateTime.Now, CreatedBy = "TestSystem"
                }
            });
            OrganisationTypeHandler.InsertRecords(
                new List <OrganisationTypeModel>
            {
                new OrganisationTypeModel {
                    Id = 1, Status = "1", Type = "1", CreatedAt = DateTime.Now, CreatedBy = "TestSystem"
                },
                new OrganisationTypeModel {
                    Id = 2, Status = "2", Type = "2", CreatedAt = DateTime.Now, CreatedBy = "TestSystem"
                },
                new OrganisationTypeModel {
                    Id = 3, Status = "3", Type = "3", CreatedAt = DateTime.Now, CreatedBy = "TestSystem"
                },
                new OrganisationTypeModel {
                    Id = 4, Status = "4", Type = "4", CreatedAt = DateTime.Now, CreatedBy = "TestSystem"
                }
            });
            ProviderTypeHandler.InsertRecords(
                new List <ProviderTypeModel>
            {
                new ProviderTypeModel {
                    Id = 1, Status = "1", ProviderType = "1", CreatedAt = DateTime.Now, CreatedBy = "TestSystem"
                },
                new ProviderTypeModel {
                    Id = 2, Status = "2", ProviderType = "2", CreatedAt = DateTime.Now, CreatedBy = "TestSystem"
                },
                new ProviderTypeModel {
                    Id = 3, Status = "3", ProviderType = "3", CreatedAt = DateTime.Now, CreatedBy = "TestSystem"
                },
                new ProviderTypeModel {
                    Id = 4, Status = "4", ProviderType = "4", CreatedAt = DateTime.Now, CreatedBy = "TestSystem"
                }
            });

            _repository = new FatDataExportRepository(new DatabaseService().DbConnectionHelper);
        }
        public void Set_up_and_run_update()
        {
            _organisationStatusId1        = 1;
            _providerTypeId1              = 10;
            _providerTypeId2              = 20;
            _organisationTypeId1          = 100;
            _organisationTypeId2          = 111;
            _organisationUkprn            = 11114433;
            _legalName                    = "Legal name 1";
            _organisationId               = Guid.NewGuid();
            _updateOrganisationRepository = new UpdateOrganisationRepository(_databaseService.DbConnectionHelper);
            _repository                   = new OrganisationRepository(_databaseService.DbConnectionHelper);
            _status1 = new OrganisationStatusModel {
                Id = _organisationStatusId1, Status = "Live", CreatedAt = DateTime.Now, CreatedBy = "TestSystem"
            };
            OrganisationStatusHandler.InsertRecord(_status1);
            _providerType1 = new ProviderTypeModel {
                Id = _providerTypeId1, ProviderType = "provider type 10", Description = "provider type description", CreatedAt = DateTime.Now, CreatedBy = "TestSystem", Status = "Live"
            };
            ProviderTypeHandler.InsertRecord(_providerType1);
            _providerType2 = new ProviderTypeModel {
                Id = _providerTypeId2, ProviderType = "provider type 12", Description = "provider type description", CreatedAt = DateTime.Now, CreatedBy = "TestSystem", Status = "Live"
            };
            ProviderTypeHandler.InsertRecord(_providerType2);
            _organisationTypeModel1 = new OrganisationTypeModel {
                Id = _organisationTypeId1, Type = "organisation type 10", Description = "organisation type description", CreatedAt = DateTime.Now, CreatedBy = "TestSystem", Status = "Live"
            };
            OrganisationTypeHandler.InsertRecord(_organisationTypeModel1);
            _organisationTypeModel2 = new OrganisationTypeModel {
                Id = _organisationTypeId2, Type = "organisation type 22", Description = "organisation type description", CreatedAt = DateTime.Now, CreatedBy = "TestSystem", Status = "Live"
            };
            OrganisationTypeHandler.InsertRecord(_organisationTypeModel2);
            _organisation = new OrganisationModel
            {
                UKPRN = _organisationUkprn,
                OrganisationTypeId = _organisationTypeId1,
                ProviderTypeId     = _providerTypeId1,
                StatusId           = _organisationStatusId1,
                StatusDate         = DateTime.Today.AddDays(5),
                LegalName          = _legalName,
                Id        = _organisationId,
                CreatedAt = DateTime.Now,
                CreatedBy = "Test"
            };
            OrganisationHandler.InsertRecord(_organisation);
            _changedBy = "SystemChange";

            _successfulUpdate    = _updateOrganisationRepository.UpdateProviderTypeAndOrganisationType(_organisationId, _providerTypeId2, _organisationTypeId2, _changedBy).Result;
            _newProviderType     = _repository.GetProviderType(_organisationId).Result;
            _newOrganisationType = _repository.GetOrganisationType(_organisationId).Result;
        }
        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);
        }
        public void Set_up_and_run_update()
        {
            _organisationStatusId         = 1;
            _providerTypeId               = 10;
            _organisationTypeId           = 100;
            _applicationDeterminedate     = DateTime.Today;
            _newApplicationDeterminedDate = DateTime.Today.AddDays(-1);
            _organisationUkprn            = 11114433;
            _organisationId               = Guid.NewGuid();
            _updateOrganisationRepository = new UpdateOrganisationRepository(_databaseService.DbConnectionHelper);
            _repository = new OrganisationRepository(_databaseService.DbConnectionHelper);
            _status     = new OrganisationStatusModel {
                Id = _organisationStatusId, Status = "Live", CreatedAt = DateTime.Now, CreatedBy = "TestSystem"
            };
            OrganisationStatusHandler.InsertRecord(_status);
            _providerType = new ProviderTypeModel {
                Id = _providerTypeId, ProviderType = "provider type 10", Description = "provider type description", CreatedAt = DateTime.Now, CreatedBy = "TestSystem", Status = "Live"
            };
            ProviderTypeHandler.InsertRecord(_providerType);
            _organisationTypeModel = new OrganisationTypeModel {
                Id = _organisationTypeId, Type = "organisation type 10", Description = "organisation type description", CreatedAt = DateTime.Now, CreatedBy = "TestSystem", Status = "Live"
            };
            OrganisationTypeHandler.InsertRecord(_organisationTypeModel);
            var organisationData = new OrganisationData {
                ApplicationDeterminedDate = _applicationDeterminedate
            };

            _organisation = new OrganisationModel
            {
                UKPRN = _organisationUkprn,
                OrganisationTypeId = _organisationTypeId,
                ProviderTypeId     = _providerTypeId,
                StatusId           = _organisationStatusId,
                StatusDate         = DateTime.Today.AddDays(5),
                LegalName          = "legal name",
                Id               = _organisationId,
                CreatedAt        = DateTime.Now,
                CreatedBy        = "Test",
                OrganisationData = JsonConvert.SerializeObject(organisationData)
            };
            OrganisationHandler.InsertRecord(_organisation);
            _originalDeterminedDate = _repository.GetApplicationDeterminedDate(_organisationId).Result;
            _changedBy = "SystemChange";

            _successfulUpdate             = _updateOrganisationRepository.UpdateApplicationDeterminedDate(_organisationId, _newApplicationDeterminedDate.Value, _changedBy).Result;
            _newApplicationDeterminedDate = _repository.GetApplicationDeterminedDate(_organisationId).Result;
        }
        public void Set_up_and_run_update()
        {
            _organisationStatusId1             = 1;
            _providerTypeId1                   = 10;
            _organisationTypeId1               = 100;
            _organisationUkprn                 = 11114433;
            _organisationId                    = Guid.NewGuid();
            _parentCompanyGuarantee            = true;
            _parentCompanyGuaranteeAfterChange = false;
            _updateOrganisationRepository      = new UpdateOrganisationRepository(_databaseService.WebConfiguration);
            _repository = new OrganisationRepository(_databaseService.WebConfiguration);
            _status1    = new OrganisationStatusModel {
                Id = _organisationStatusId1, Status = "Live", CreatedAt = DateTime.Now, CreatedBy = "TestSystem"
            };
            OrganisationStatusHandler.InsertRecord(_status1);
            _providerType1 = new ProviderTypeModel {
                Id = _providerTypeId1, ProviderType = "provider type 10", Description = "provider type description", CreatedAt = DateTime.Now, CreatedBy = "TestSystem", Status = "Live"
            };
            ProviderTypeHandler.InsertRecord(_providerType1);
            _organisationTypeModel1 = new OrganisationTypeModel {
                Id = _organisationTypeId1, Type = "organisation type 10", Description = "organisation type description", CreatedAt = DateTime.Now, CreatedBy = "TestSystem", Status = "Live"
            };
            OrganisationTypeHandler.InsertRecord(_organisationTypeModel1);
            var organisationData = new OrganisationData {
                ParentCompanyGuarantee = _parentCompanyGuarantee
            };

            _organisation = new OrganisationModel
            {
                UKPRN = _organisationUkprn,
                OrganisationTypeId = _organisationTypeId1,
                ProviderTypeId     = _providerTypeId1,
                StatusId           = _organisationStatusId1,
                StatusDate         = DateTime.Today.AddDays(5),
                LegalName          = "legal name",
                Id               = _organisationId,
                CreatedAt        = DateTime.Now,
                CreatedBy        = "Test",
                OrganisationData = JsonConvert.SerializeObject(organisationData)
            };
            OrganisationHandler.InsertRecord(_organisation);
            _originalParentCompanyGuarantee = _repository.GetParentCompanyGuarantee(_organisationId).Result;
            _changedBy = "SystemChange";

            _successfulUpdate          = _updateOrganisationRepository.UpdateParentCompanyGuarantee(_organisationId, _parentCompanyGuaranteeAfterChange, _changedBy).Result;
            _newParentCompanyGuarantee = _repository.GetParentCompanyGuarantee(_organisationId).Result;
        }
Beispiel #17
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
            };
        }
Beispiel #18
0
 public void Before_the_tests()
 {
     _organisationStatusId1 = 1;
     _providerTypeId1       = ProviderType.MainProvider;
     _organisationTypeId1   = 100;
     _repository            = new CreateOrganisationRepository(_databaseService.DbConnectionHelper);
     _status1 = new OrganisationStatusModel {
         Id = _organisationStatusId1, Status = "Live", CreatedAt = DateTime.Now, CreatedBy = "TestSystem"
     };
     OrganisationStatusHandler.InsertRecord(_status1);
     _providerType1 = new ProviderTypeModel {
         Id = _providerTypeId1, ProviderType = "provider type 10", Description = "provider type description", CreatedAt = DateTime.Now, CreatedBy = "TestSystem", Status = "Live"
     };
     ProviderTypeHandler.InsertRecord(_providerType1);
     _organisationTypeModel1 = new OrganisationTypeModel {
         Id = _organisationTypeId1, Type = "organisation type 10", Description = "organisation type description", CreatedAt = DateTime.Now, CreatedBy = "TestSystem", Status = "Live"
     };
     OrganisationTypeHandler.InsertRecord(_organisationTypeModel1);
 }
Beispiel #19
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);
        }
        public void Set_up_and_run_update()
        {
            _organisationStatusId1  = 1;
            _providerTypeId1        = 10;
            _organisationTypeId1    = 100;
            _organisationUkprn      = 11114433;
            _tradingName            = "Trading name 1";
            _tradingNameAfterChange = "Trading Name Version 2";
            _organisationId         = Guid.NewGuid();
            _updateRepository       = new UpdateOrganisationRepository(_databaseService.WebConfiguration);
            _repository             = new OrganisationRepository(_databaseService.WebConfiguration);
            _status1 = new OrganisationStatusModel {
                Id = _organisationStatusId1, Status = "Live", CreatedAt = DateTime.Now, CreatedBy = "TestSystem"
            };
            OrganisationStatusHandler.InsertRecord(_status1);
            _providerType1 = new ProviderTypeModel {
                Id = _providerTypeId1, ProviderType = "provider type 10", Description = "provider type description", CreatedAt = DateTime.Now, CreatedBy = "TestSystem", Status = "Live"
            };
            ProviderTypeHandler.InsertRecord(_providerType1);
            _organisationTypeModel1 = new OrganisationTypeModel {
                Id = _organisationTypeId1, Type = "organisation type 10", Description = "organisation type description", CreatedAt = DateTime.Now, CreatedBy = "TestSystem", Status = "Live"
            };
            OrganisationTypeHandler.InsertRecord(_organisationTypeModel1);
            _organisation = new OrganisationModel
            {
                UKPRN = _organisationUkprn,
                OrganisationTypeId = _organisationTypeId1,
                ProviderTypeId     = _providerTypeId1,
                StatusId           = _organisationStatusId1,
                StatusDate         = DateTime.Today.AddDays(5),
                TradingName        = _tradingName,
                LegalName          = "Legal Name 1",
                Id        = _organisationId,
                CreatedAt = DateTime.Now,
                CreatedBy = "Test"
            };
            OrganisationHandler.InsertRecord(_organisation);
            _originalTradingName = _repository.GetTradingName(_organisationId).Result;
            _changedBy           = "SystemChange";

            _successfulUpdate = _updateRepository.UpdateTradingName(_organisationId, _tradingNameAfterChange, _changedBy).Result;
            _newTradingName   = _repository.GetTradingName(_organisationId).Result;
        }
Beispiel #21
0
        public void setup_organisation_is_added()
        {
            _organisationStatusId1  = 1;
            _providerTypeId1        = 10;
            _organisationTypeId1    = 100;
            _organisationUkprn      = 11114433;
            _organisationId         = Guid.NewGuid();
            _parentCompanyGuarantee = true;
            _repository             = new OrganisationRepository(_databaseService.DbConnectionHelper);
            _status1 = new OrganisationStatusModel {
                Id = _organisationStatusId1, Status = "Live", CreatedAt = DateTime.Now, CreatedBy = "TestSystem"
            };
            OrganisationStatusHandler.InsertRecord(_status1);
            _providerType1 = new ProviderTypeModel {
                Id = _providerTypeId1, ProviderType = "provider type 10", Description = "provider type description", CreatedAt = DateTime.Now, CreatedBy = "TestSystem", Status = "Live"
            };
            ProviderTypeHandler.InsertRecord(_providerType1);
            _organisationTypeModel1 = new OrganisationTypeModel {
                Id = _organisationTypeId1, Type = "organisation type 10", Description = "organisation type description", CreatedAt = DateTime.Now, CreatedBy = "TestSystem", Status = "Live"
            };
            OrganisationTypeHandler.InsertRecord(_organisationTypeModel1);

            var organisationData = new OrganisationData {
                ParentCompanyGuarantee = _parentCompanyGuarantee
            };

            _organisation = new OrganisationModel
            {
                UKPRN = _organisationUkprn,
                OrganisationTypeId = _organisationTypeId1,
                ProviderTypeId     = _providerTypeId1,
                StatusId           = _organisationStatusId1,
                StatusDate         = DateTime.Today.AddDays(5),
                LegalName          = "legal name 1",
                Id               = _organisationId,
                CreatedAt        = DateTime.Now,
                CreatedBy        = "Test",
                OrganisationData = JsonConvert.SerializeObject(organisationData)
            };
            OrganisationHandler.InsertRecord(_organisation);
        }
        public void Before_the_tests()
        {
            _lookupRepository              = new LookupDataRepository(_databaseService.WebConfiguration, _cacheHelper);
            _organisationValidator         = new OrganisationValidator(null, _lookupRepository, null);
            _organisationTypeId1           = 10;
            _organisationTypeId2           = 20;
            _organisationTypeId3           = 30;
            _organisationTypeIdNonExistent = 100;
            _numberOfExpectedResults       = 3;
            _cacheHelper.PurgeAllCaches();


            OrganisationTypeHandler.InsertRecord(new OrganisationTypeModel {
                Id = _organisationTypeId1, CreatedAt = DateTime.Now, CreatedBy = "system", Status = "x", Type = "a"
            });
            OrganisationTypeHandler.InsertRecord(new OrganisationTypeModel {
                Id = _organisationTypeId2, CreatedAt = DateTime.Now, CreatedBy = "system", Status = "x", Type = "b"
            });
            OrganisationTypeHandler.InsertRecord(new OrganisationTypeModel {
                Id = _organisationTypeId3, CreatedAt = DateTime.Now, CreatedBy = "system", Status = "x", Type = "c"
            });
        }
Beispiel #23
0
        public void SetUpOrganisationTests()
        {
            _repository               = new RegisterRepository(_databaseService.WebConfiguration, new Mock <ILogger <RegisterRepository> >().Object);
            _organisationIdCreated    = "EPA987";
            _ukprnBefore              = 123321;
            _ukprnAfter               = 124421;
            _organisationTypeIdBefore = 5;
            _organisationTypeIdAfter  = 6;
            _updatedAt = DateTime.Today.Date.AddHours(9);
            OrganisationTypeHandler.InsertRecord(new OrganisationTypeModel {
                Id = _organisationTypeIdBefore, Status = "new", Type = "organisation type 1"
            });
            OrganisationTypeHandler.InsertRecord(new OrganisationTypeModel {
                Id = _organisationTypeIdAfter, Status = "new", Type = "organisation type 2"
            });
            _nameUpdated = "name 2";
            _createdAt   = DateTime.Today.Date.AddHours(8);

            _initialOrganisationDetails = new EpaOrganisation
            {
                Id                 = Guid.NewGuid(),
                CreatedAt          = _createdAt,
                Name               = "name 1",
                OrganisationId     = _organisationIdCreated,
                Ukprn              = _ukprnBefore,
                PrimaryContact     = null,
                PrimaryContactName = null,
                Status             = OrganisationStatus.New,
                OrganisationTypeId = _organisationTypeIdBefore,
                OrganisationData   = new OrganisationData
                {
                    LegalName   = " legal name",
                    TradingName = "trading name",
                    Address1    = "address 1",
                    Address2    = "address 2",
                    Address3    = "address 3",
                    Address4    = "address 4",
                    Postcode    = "postcode"
                }
            };

            _updatedOrgData = new OrganisationData
            {
                LegalName   = " legal name 2",
                TradingName = "trading name 2",
                Address1    = "address 1b",
                Address2    = "address 2b",
                Address3    = "address 3b",
                Address4    = "address 4b",
                Postcode    = "postcodeb"
            };

            _expectedOrganisationDetails = new EpaOrganisation
            {
                Id                 = _initialOrganisationDetails.Id,
                CreatedAt          = _createdAt,
                Name               = _nameUpdated,
                OrganisationId     = _organisationIdCreated,
                Ukprn              = _ukprnAfter,
                PrimaryContact     = null,
                PrimaryContactName = null,
                Status             = OrganisationStatus.New,
                UpdatedAt          = _updatedAt,
                OrganisationTypeId = _organisationTypeIdAfter,
                OrganisationData   = _updatedOrgData
            };
        }
        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");
        }
 public void TearDownOrganisationTests()
 {
     OrganisationHandler.DeleteRecordByOrganisationId(_organisationIdCreated);
     OrganisationTypeHandler.DeleteRecord(_organisationTypeIdBefore);
     OrganisationTypeHandler.DeleteRecord(_organisationTypeIdAfter);
 }
 public void Tear_down()
 {
     OrganisationTypeHandler.DeleteAllRecords();
 }
Beispiel #27
0
 public void TearDownOrganisationTypesTests()
 {
     OrganisationTypeHandler.DeleteRecords(new List <int> {
         _organisationType1.Id, _organisationType2.Id
     });
 }
Beispiel #28
0
 public void Tear_down()
 {
     ProviderTypeOrganisationTypeHandler.DeleteAllRecords();
     ProviderTypeHandler.DeleteAllRecords();
     OrganisationTypeHandler.DeleteAllRecords();
 }
        public void SetUpOrganisationTests()
        {
            _repository            = new RegisterRepository(_databaseService.WebConfiguration, new Mock <ILogger <RegisterRepository> >().Object);
            _validationRepository  = new RegisterValidationRepository(_databaseService.WebConfiguration);
            _organisationIdCreated = "EPA0987";
            _organisationTypeId    = 5;
            OrganisationTypeHandler.InsertRecord(new OrganisationTypeModel {
                Id = _organisationTypeId, Status = "new", Type = "organisation type 1"
            });
            _id = Guid.NewGuid();

            _organisation = new OrganisationModel
            {
                Id                             = _id,
                CreatedAt                      = DateTime.Now,
                EndPointAssessorName           = "name 2",
                EndPointAssessorOrganisationId = _organisationIdCreated,
                PrimaryContact                 = null,
                OrganisationTypeId             = _organisationTypeId,
                OrganisationData               = null,
                Status                         = OrganisationStatus.New
            };

            _username = "******";
            OrganisationHandler.InsertRecord(_organisation);
            _contactId    = Guid.NewGuid();
            _contactModel = new OrganisationContactModel
            {
                Id = _contactId,
                EndPointAssessorOrganisationId = _organisationIdCreated,
                OrganisationId = _id,
                Username       = _username,
                DisplayName    = "Joe Cool",
                Email          = "*****@*****.**",
                PhoneNumber    = "555 55555",
                Status         = OrganisationStatus.Live
            };

            _contactBeforeChange = new EpaContact
            {
                Id = _contactId,
                EndPointAssessorOrganisationId = _organisationIdCreated,
                Username    = _username,
                DisplayName = "Joe Cool",
                Email       = "*****@*****.**",
                PhoneNumber = "555 55555",
                Status      = OrganisationStatus.Live
            };

            _contactUpdated = new EpaContact
            {
                Id = _contactId,
                EndPointAssessorOrganisationId = _organisationIdCreated,
                Username    = _username,
                DisplayName = "Joe Cool changes",
                Email       = "*****@*****.**",
                PhoneNumber = "555 44444",
                Status      = OrganisationStatus.Live
            };
            OrganisationContactHandler.InsertRecord(_contactModel);
        }
Beispiel #30
0
 public void TearDownOrganisationTests()
 {
     OrganisationHandler.DeleteRecordByEndPointAssessorOrganisationId(_organisationIdCreated);
     OrganisationTypeHandler.DeleteRecord(_organisationTypeId);
 }