Exemplo n.º 1
0
        public void CreateOrganisationThatDoesntExistAndCheckItIsThere()
        {
            var maxOrgWithNoData = _queryRepository.EpaOrganisationIdCurrentMaximum().Result;

            var isOrgByOrgIdPresentBeforeInsert = _validationRepository.EpaOrganisationExistsWithOrganisationId(_organisationIdCreated).Result;
            var isOrgByUkprnPresentBeforeInsert = _validationRepository.EpaOrganisationExistsWithUkprn(_ukprnCreated).Result;
            var returnedOrganisationId          = _repository.CreateEpaOrganisation(_organisation).Result;
            var org2 = _repository.CreateEpaOrganisation(_organisation2).Result;
            var isOrgByOrgIdPresentAfterInsert            = _validationRepository.EpaOrganisationExistsWithOrganisationId(_organisationIdCreated).Result;
            var isOrgByUkprnPresentAfterInsert            = _validationRepository.EpaOrganisationExistsWithUkprn(_ukprnCreated).Result;
            var returnedOrganisationByGetById             = _queryRepository.GetEpaOrganisationById(_id).Result;
            var returnedOrganisationByGetByOrganisationId =
                _queryRepository.GetEpaOrganisationByOrganisationId(_organisationIdCreated).Result;
            var maxOrgWithData = _queryRepository.EpaOrganisationIdCurrentMaximum().Result;

            Assert.IsNull(maxOrgWithNoData);
            Assert.IsFalse(isOrgByOrgIdPresentBeforeInsert);
            Assert.IsFalse(isOrgByUkprnPresentBeforeInsert);

            Assert.AreEqual(_organisation.Ukprn, returnedOrganisationByGetById.Ukprn);
            Assert.IsTrue(isOrgByOrgIdPresentAfterInsert);

            Assert.IsTrue(isOrgByUkprnPresentAfterInsert);
            Assert.AreEqual(_ukprnCreated, returnedOrganisationByGetById.Ukprn);
            Assert.AreEqual(_ukprnCreated, returnedOrganisationByGetByOrganisationId.Ukprn);
            StringAssert.Contains(maxOrgWithData, _organisationIdCreated);
        }
Exemplo n.º 2
0
        public void UpdateOrganisationAndCheckUpdatesHaveHappened()
        {
            var expectedOrgId  = _repository.CreateEpaOrganisation(_initialOrganisationDetails).Result;
            var initialResults = OrganisationHandler.GetOrganisationByOrgId(_organisationIdCreated);

            initialResults.Name               = _nameUpdated;
            initialResults.Ukprn              = _ukprnAfter;
            initialResults.UpdatedAt          = _updatedAt;
            initialResults.OrganisationTypeId = _organisationTypeIdAfter;
            initialResults.OrganisationData   = _updatedOrgData;
            var upatedOrgId    = _repository.UpdateEpaOrganisation(initialResults).Result;
            var updatedResults = OrganisationHandler.GetOrganisationByOrgId(_organisationIdCreated);

            updatedResults.CreatedAt = _createdAt;
            updatedResults.UpdatedAt = _updatedAt;
            _expectedOrganisationDetails.Should().BeEquivalentTo(updatedResults);
        }