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 static void InsertRecord(OrganisationStatusModel organisationStatus) { var sql = @"set identity_insert [OrganisationStatus] ON; INSERT INTO [OrganisationStatus] ([id], [Status],[CreatedAt],[CreatedBy] ,[UpdatedAt],[UpdatedBy], EventDescription) VALUES " + $@"(@id,@status, @createdAt, @createdBy, @updatedAt, @updatedBy, @eventDescription); set identity_insert [OrganisationStatus] OFF; "; DatabaseService.Execute(sql, organisationStatus); }
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; }
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 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; }
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); }