private async void ThrowErrorOnSaveOfSamePrimaryKeyLinkEnquires() { var faker = TestBuilders.Faker(); var linkReferenceNumber = faker.Random.Hash(); var dbContext = PatientContext(); var linkPatientRepository = new LinkPatientRepository(dbContext); var linkedCareContext = new List <CareContext> { new CareContext(faker.Random.Word()) }; var linkRequest = new LinkEnquires(faker.Random.Hash(), linkReferenceNumber, faker.Random.Hash(), faker.Random.Hash(), faker.Random.Hash(), linkedCareContext); await linkPatientRepository.SaveRequestWith( linkRequest.LinkReferenceNumber, linkRequest.ConsentManagerId, linkRequest.ConsentManagerUserId, linkRequest.PatientReferenceNumber, new[] { faker.Random.Word() }); var(_, error) = await linkPatientRepository.SaveRequestWith( linkRequest.LinkReferenceNumber, linkRequest.ConsentManagerId, linkRequest.ConsentManagerUserId, linkRequest.PatientReferenceNumber, new[] { faker.Random.Word() }); error.Should().NotBeNull(); dbContext.Database.EnsureDeleted(); }
private async void ShouldSaveLinkRequest() { var faker = TestBuilders.Faker(); var dbContext = PatientContext(); var linkPatientRepository = new LinkPatientRepository(dbContext); var linkReferenceNumber = faker.Random.Hash(); var(link, _) = await linkPatientRepository.SaveRequestWith(linkReferenceNumber, faker.Random.Hash() , faker.Random.Hash(), faker.Random.Hash(), new[] { (faker.Random.Word()) }); var(patientFor, _) = await linkPatientRepository.GetPatientFor(linkReferenceNumber); link.Should().BeEquivalentTo(patientFor); dbContext.Database.EnsureDeleted(); }