public void Update_ClaimedCapabilityReview_Remove_EndChain_Succeeds()
    {
      var contact = Retriever.GetAllContacts(_policy).First();
      var cap = Retriever.GetAllCapabilities(_policy).First();
      var claim = Creator.GetCapabilitiesImplemented(claimId: cap.Id, solnId: _solnEx.Solution.Id, ownerId: contact.Id);
      ClearClaimedCapability();
      _solnEx.ClaimedCapability.Add(claim);

      var contId = GetContact().Id;
      var evidence = Creator.GetCapabilitiesImplementedEvidence(claimId: claim.Id, createdById: contId);
      var reviewPrev = Creator.GetCapabilitiesImplementedReviews(evidenceId: evidence.Id, createdById: contId);
      var review = Creator.GetCapabilitiesImplementedReviews(prevId: reviewPrev.Id, evidenceId: evidence.Id, createdById: contId);
      _solnEx.ClaimedCapabilityEvidence.Add(evidence);
      _solnEx.ClaimedCapabilityReview.Add(reviewPrev);
      _solnEx.ClaimedCapabilityReview.Add(review);
      _datastore.Update(_solnEx);
      _solnEx.ClaimedCapabilityReview.Remove(review);

      _datastore.Update(_solnEx);

      var retrievedSolnEx = _datastore.BySolution(_solnEx.Solution.Id);
      retrievedSolnEx.ClaimedCapabilityReview
        .Should().ContainSingle()
        .And.Subject.Single()
        .Should().BeEquivalentTo(reviewPrev,
          opts => opts
            .Excluding(ent => ent.CreatedOn));
    }
    public void Update_ClaimedCapabilityEvidence_Add_EndChain_Succeeds()
    {
      var contact = Retriever.GetAllContacts(_policy).First();
      var cap = Retriever.GetAllCapabilities(_policy).First();
      var claim = Creator.GetCapabilitiesImplemented(claimId: cap.Id, solnId: _solnEx.Solution.Id, ownerId: contact.Id);
      ClearClaimedCapability();
      _solnEx.ClaimedCapability.Add(claim);

      var contId = GetContact().Id;
      var evidencePrev = Creator.GetCapabilitiesImplementedEvidence(claimId: claim.Id, createdById: contId);
      _solnEx.ClaimedCapabilityEvidence.Add(evidencePrev);
      _datastore.Update(_solnEx);
      var evidence = Creator.GetCapabilitiesImplementedEvidence(prevId: evidencePrev.Id, claimId: claim.Id, createdById: contId);
      _solnEx.ClaimedCapabilityEvidence.Add(evidence);

      _datastore.Update(_solnEx);

      var retrievedSolnEx = _datastore.BySolution(_solnEx.Solution.Id);
      retrievedSolnEx.ClaimedCapabilityEvidence
        .Should().HaveCount(2)
        .And.Subject
        .Should().BeEquivalentTo(new[] { evidence, evidencePrev },
          opts => opts
            .Excluding(ent => ent.CreatedOn));
    }
        public void Update_ClaimedCapabilityReview_Remove_Chain_Succeeds()
        {
            var contact = Retriever.GetAllContacts(_policy).First();
            var cap     = Retriever.GetAllCapabilities(_policy).First();
            var claim   = Creator.GetCapabilitiesImplemented(claimId: cap.Id, solnId: _solnEx.Solution.Id, ownerId: contact.Id);

            ClearClaimedCapability();
            _solnEx.ClaimedCapability.Add(claim);

            var contId     = GetContact().Id;
            var evidence   = Creator.GetCapabilitiesImplementedEvidence(claimId: claim.Id, createdById: contId);
            var reviewPrev = Creator.GetCapabilitiesImplementedReviews(evidenceId: evidence.Id, createdById: contId);
            var review     = Creator.GetCapabilitiesImplementedReviews(prevId: reviewPrev.Id, evidenceId: evidence.Id, createdById: contId);

            _solnEx.ClaimedCapabilityEvidence.Add(evidence);
            _solnEx.ClaimedCapabilityReview.Add(reviewPrev);
            _solnEx.ClaimedCapabilityReview.Add(review);
            _datastore.Update(_solnEx);
            _solnEx.ClaimedCapabilityReview.Clear();

            _datastore.Update(_solnEx);

            var retrievedSolnEx = _datastore.BySolution(_solnEx.Solution.Id);

            retrievedSolnEx.ClaimedCapabilityReview
            .Should().BeEmpty();
        }
    public void Update_ClaimedCapability_Add_Succeeds()
    {
      var contact = Retriever.GetAllContacts(_policy).First();
      var cap = Retriever.GetAllCapabilities(_policy).First();
      var claim = Creator.GetCapabilitiesImplemented(claimId: cap.Id, solnId: _solnEx.Solution.Id, ownerId: contact.Id);
      ClearClaimedCapability();
      _solnEx.ClaimedCapability.Add(claim);

      _datastore.Update(_solnEx);

      var retrievedSolnEx = _datastore.BySolution(_solnEx.Solution.Id);
      retrievedSolnEx.ClaimedCapability
        .Should().ContainSingle()
        .And.Subject
        .Should().BeEquivalentTo(claim);
    }