示例#1
0
        public void Set_up_and_run_update()
        {
            _organisationStatusId1        = 1;
            _providerTypeId1              = 10;
            _organisationTypeId1          = 100;
            _charityNumber                = "44443333";
            _organisationUkprn            = 11114433;
            _organisationId               = Guid.NewGuid();
            _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 {
                CharityNumber = _charityNumber
            };

            _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);
            _originalCharityNumber = _repository.GetCharityNumber(_organisationId).Result;
            _changedBy             = "SystemChange";

            _successfulUpdate = _updateOrganisationRepository.UpdateCharityNumber(_organisationId, _newCharityNumber, _changedBy).Result;
            _newCharityNumber = _repository.GetCharityNumber(_organisationId).Result;
        }