Beispiel #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);
        }
        public void CheckEpaOrganisationIsAlreadyUsingUkprn(long ukprn, bool doesExist)
        {
            var exists = _validationRepository.EpaOrganisationExistsWithUkprn(ukprn).Result;

            Assert.AreEqual(doesExist, exists);
        }