public void CRUD_Succeeds() { var contact = Retriever.GetAllContacts(_policy).First(); var soln = Retriever.GetAllSolutions(_policy).First(); var cap = Retriever.GetAllCapabilities(_policy).First(); var datastore = new CapabilitiesImplementedDatastore(DatastoreBaseSetup.CapabilitiesImplementedDatastore, _logger, _policy); // create var newEnt = Creator.GetCapabilitiesImplemented(solnId: soln.Id, claimId: cap.Id, ownerId: contact.Id); var createdEnt = datastore.Create(newEnt); try { createdEnt.Should().BeEquivalentTo(newEnt); // update createdEnt.Status = CapabilitiesImplementedStatus.Submitted; datastore.Update(createdEnt); // retrieve datastore.ById(createdEnt.Id) .Should().BeEquivalentTo(createdEnt); } finally { // delete datastore.Delete(createdEnt); } // delete datastore.ById(createdEnt.Id) .Should().BeNull(); }
public void CRUD_Succeeds() { var contact = Retriever.GetAllContacts(_policy).First(); var soln = Retriever.GetAllSolutions(_policy).First(); var std = Retriever.GetAllStandards(_policy).First(); var datastore = new StandardsApplicableDatastore(DatastoreBaseSetup.StandardsApplicableDatastore, _logger, _policy); // create var newEnt = Creator.GetStandardsApplicable(solnId: soln.Id, claimId: std.Id, ownerId: contact.Id); var createdEnt = datastore.Create(newEnt); try { createdEnt.Should().BeEquivalentTo(newEnt); // update createdEnt.Status = StandardsApplicableStatus.Submitted; datastore.Update(createdEnt); // retrieve datastore.ById(createdEnt.Id) .Should().BeEquivalentTo(createdEnt); } finally { // delete datastore.Delete(createdEnt); } // delete datastore.ById(createdEnt.Id) .Should().BeNull(); }
public void ByOrganisation_ReturnsData() { var datas = Retriever.GetAllContacts(_policy); datas.Should().NotBeEmpty(); datas.ForEach(data => data.Should().NotBeNull()); datas.ForEach(data => Verifier.Verify(data)); }
public void CRUD_Succeeds() { var contact = Retriever.GetAllContacts(_policy).First(); var orgDatastore = new OrganisationsDatastore(DatastoreBaseSetup.OrganisationsDatastore, new Mock <ILogger <OrganisationsDatastore> >().Object, _policy, _config, new Mock <ILongTermCache>().Object); var org = orgDatastore.ById(contact.OrganisationId); var solnDatastore = new SolutionsDatastore(DatastoreBaseSetup.SolutionsDatastore, new Mock <ILogger <SolutionsDatastore> >().Object, _policy, _config, new Mock <IShortTermCache>().Object, new Mock <IServiceProvider>().Object); var soln = solnDatastore.ByOrganisation(org.Id).First(); var std = Retriever.GetAllStandards(_policy).First(); var claimDatastore = new StandardsApplicableDatastore(DatastoreBaseSetup.StandardsApplicableDatastore, new Mock <ILogger <StandardsApplicableDatastore> >().Object, _policy); var evidenceDatastore = new StandardsApplicableEvidenceDatastore(DatastoreBaseSetup.StandardsApplicableEvidenceDatastore, new Mock <ILogger <StandardsApplicableEvidenceDatastore> >().Object, _policy); var datastore = new StandardsApplicableReviewsDatastore(DatastoreBaseSetup.StandardsApplicableReviewsDatastore, _logger, _policy); var newClaim = Creator.GetStandardsApplicable(solnId: soln.Id, claimId: std.Id, ownerId: contact.Id); var createdClaim = claimDatastore.Create(newClaim); StandardsApplicableReviews createdReview = null; try { var newEvidence = Creator.GetStandardsApplicableEvidence(claimId: createdClaim.Id, createdById: contact.Id); var createdEvidence = evidenceDatastore.Create(newEvidence); // create var newReview = Creator.GetStandardsApplicableReviews(evidenceId: createdEvidence.Id, createdById: contact.Id); createdReview = datastore.Create(newReview); createdReview.Should().BeEquivalentTo(newReview, opts => opts .Excluding(ent => ent.CreatedOn)); // retrieve ById datastore.ById(createdReview.Id) .Should().NotBeNull() .And.Subject .Should().BeEquivalentTo(createdReview, opts => opts .Excluding(ent => ent.CreatedOn)); // retrieve ByEvidence var retrievedReviews = datastore.ByEvidence(createdEvidence.Id) .SelectMany(x => x).ToList(); retrievedReviews.Should().ContainSingle() .And.Subject.Single() .Should().BeEquivalentTo(createdReview, opts => opts .Excluding(ent => ent.CreatedOn)); } finally { claimDatastore.Delete(createdClaim); } // delete datastore.ById(createdReview.Id) .Should().BeNull(); }
public void CRUD_Succeeds() { var contact = Retriever.GetAllContacts(_policy).First(); var orgDatastore = new OrganisationsDatastore(DatastoreBaseSetup.CrmConnectionFactory, new Mock <ILogger <OrganisationsDatastore> >().Object, _policy, _config, new Mock <IDatastoreCache>().Object); var org = orgDatastore.ById(contact.OrganisationId); var solnDatastore = new SolutionsDatastore(DatastoreBaseSetup.CrmConnectionFactory, new Mock <ILogger <SolutionsDatastore> >().Object, _policy, _config); var soln = solnDatastore.ByOrganisation(org.Id).First(); var cap = Retriever.GetAllCapabilities(_policy).First(); var claimDatastore = new CapabilitiesImplementedDatastore(DatastoreBaseSetup.CrmConnectionFactory, new Mock <ILogger <CapabilitiesImplementedDatastore> >().Object, _policy, _config); var evidenceDatastore = new CapabilitiesImplementedEvidenceDatastore(DatastoreBaseSetup.CrmConnectionFactory, new Mock <ILogger <CapabilitiesImplementedEvidenceDatastore> >().Object, _policy, _config); var datastore = new CapabilitiesImplementedReviewsDatastore(DatastoreBaseSetup.CrmConnectionFactory, _logger, _policy, _config); var newClaim = Creator.GetCapabilitiesImplemented(solnId: soln.Id, claimId: cap.Id, ownerId: contact.Id); var createdClaim = claimDatastore.Create(newClaim); CapabilitiesImplementedReviews createdReview = null; try { var newEvidence = Creator.GetCapabilitiesImplementedEvidence(claimId: createdClaim.Id, createdById: contact.Id); var createdEvidence = evidenceDatastore.Create(newEvidence); // create var newReview = Creator.GetCapabilitiesImplementedReviews(evidenceId: createdEvidence.Id, createdById: contact.Id); createdReview = datastore.Create(newReview); createdReview.Should().BeEquivalentTo(newReview, opts => opts .Excluding(ent => ent.CreatedOn)); // retrieve ById datastore.ById(createdReview.Id) .Should().NotBeNull() .And.Subject .Should().BeEquivalentTo(createdReview, opts => opts .Excluding(ent => ent.CreatedOn)); // retrieve ByEvidence var retrievedReviews = datastore.ByEvidence(createdEvidence.Id) .SelectMany(x => x).ToList(); retrievedReviews.Should().ContainSingle() .And.Subject.Single() .Should().BeEquivalentTo(createdReview, opts => opts .Excluding(ent => ent.CreatedOn)); } finally { claimDatastore.Delete(createdClaim); } // delete datastore.ById(createdReview.Id) .Should().BeNull(); }
public void ById_ReturnsData() { var ids = Retriever.GetAllContacts(_policy).Select(ent => ent.Id); var datastore = new ContactsDatastore(DatastoreBaseSetup.ContactsDatastore, _logger, _policy, _config, new Mock <ILongTermCache>().Object); var datas = ids.Select(id => datastore.ById(id)).ToList(); datas.Should().NotBeEmpty(); datas.ForEach(data => data.Should().NotBeNull()); datas.ForEach(data => Verifier.Verify(data)); }
public void ByEmail_ReturnsData() { var emails = Retriever.GetAllContacts(_policy).Select(ent => ent.EmailAddress1).ToList(); var datastore = new ContactsDatastore(DatastoreBaseSetup.CrmConnectionFactory, _logger, _policy, _config, new Mock <IDatastoreCache>().Object); var datas = emails.Select(email => datastore.ByEmail(email)).ToList(); datas.Should().NotBeEmpty(); datas.ForEach(data => data.Should().NotBeNull()); datas.ForEach(data => Verifier.Verify(data)); }
public void BySolution_ReturnsData() { var allSolns = Retriever.GetAllSolutions(_policy); var ids = allSolns.Select(soln => soln.Id).Distinct().ToList(); var datastore = new StandardsApplicableDatastore(DatastoreBaseSetup.StandardsApplicableDatastore, _logger, _policy); var datas = ids.SelectMany(id => datastore.BySolution(id)).ToList(); datas.Should().NotBeEmpty(); datas.ForEach(data => data.Should().NotBeNull()); datas.ForEach(data => Verifier.Verify(data)); }
public void BySolution_ReturnsData() { var allSolns = Retriever.GetAllSolutions(_policy); var ids = allSolns.Select(soln => soln.Id).Distinct().ToList(); var datastore = new CapabilitiesImplementedDatastore(DatastoreBaseSetup.CrmConnectionFactory, _logger, _policy, _config); var datas = ids.SelectMany(id => datastore.BySolution(id)).ToList(); datas.Should().NotBeEmpty(); datas.ForEach(data => data.Should().NotBeNull()); datas.ForEach(data => Verifier.Verify(data)); }