public void Update_ClaimedStandardReview_Remove_EndChain_Succeeds()
    {
      var contact = Retriever.GetAllContacts(_policy).First();
      var std = Retriever.GetAllStandards(_policy).First();
      var claim = Creator.GetStandardsApplicable(claimId: std.Id, solnId: _solnEx.Solution.Id, ownerId: contact.Id);
      ClearClaimedStandard();
      _solnEx.ClaimedStandard.Add(claim);

      var contId = GetContact().Id;
      var evidence = Creator.GetStandardsApplicableEvidence(claimId: claim.Id, createdById: contId);
      var reviewPrev = Creator.GetStandardsApplicableReviews(evidenceId: evidence.Id, createdById: contId);
      var review = Creator.GetStandardsApplicableReviews(prevId: reviewPrev.Id, evidenceId: evidence.Id, createdById: contId);
      _solnEx.ClaimedStandardEvidence.Add(evidence);
      _solnEx.ClaimedStandardReview.Add(reviewPrev);
      _solnEx.ClaimedStandardReview.Add(review);
      _datastore.Update(_solnEx);
      _solnEx.ClaimedStandardReview.Remove(review);

      _datastore.Update(_solnEx);

      var retrievedSolnEx = _datastore.BySolution(_solnEx.Solution.Id);
      retrievedSolnEx.ClaimedStandardReview
        .Should().ContainSingle()
        .And.Subject.Single()
        .Should().BeEquivalentTo(reviewPrev,
          opts => opts
            .Excluding(ent => ent.CreatedOn));
    }
    public void Update_ClaimedStandardEvidence_Add_EndChain_Succeeds()
    {
      var contact = Retriever.GetAllContacts(_policy).First();
      var std = Retriever.GetAllStandards(_policy).First();
      var claim = Creator.GetStandardsApplicable(claimId: std.Id, solnId: _solnEx.Solution.Id, ownerId: contact.Id);
      ClearClaimedStandard();
      _solnEx.ClaimedStandard.Add(claim);

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

      _datastore.Update(_solnEx);

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

            ClearClaimedStandard();
            _solnEx.ClaimedStandard.Add(claim);

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

            _solnEx.ClaimedStandardEvidence.Add(evidence);
            _solnEx.ClaimedStandardReview.Add(reviewPrev);
            _solnEx.ClaimedStandardReview.Add(review);
            _datastore.Update(_solnEx);
            _solnEx.ClaimedStandardReview.Clear();

            _datastore.Update(_solnEx);

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

            retrievedSolnEx.ClaimedStandardReview
            .Should().BeEmpty();
        }
    public void Update_ClaimedStandard_Add_Succeeds()
    {
      var contact = Retriever.GetAllContacts(_policy).First();
      var std = Retriever.GetAllStandards(_policy).First();
      var claim = Creator.GetStandardsApplicable(claimId: std.Id, solnId: _solnEx.Solution.Id, ownerId: contact.Id);
      ClearClaimedStandard();
      _solnEx.ClaimedStandard.Add(claim);

      _datastore.Update(_solnEx);

      var retrievedSolnEx = _datastore.BySolution(_solnEx.Solution.Id);
      retrievedSolnEx.ClaimedStandard
        .Should().ContainSingle()
        .And.Subject.Single()
        .Should().BeEquivalentTo(claim);
    }
    public void Update_ClaimedStandard_Remove_Succeeds()
    {
      var contact = Retriever.GetAllContacts(_policy).First();
      var std = Retriever.GetAllStandards(_policy).First();
      var claim = Creator.GetStandardsApplicable(claimId: std.Id, solnId: _solnEx.Solution.Id, ownerId: contact.Id);
      ClearClaimedStandard();
      _solnEx.ClaimedStandard.Add(claim);

      _datastore.Update(_solnEx);
      _solnEx.ClaimedStandard.Clear();

      _datastore.Update(_solnEx);

      var retrievedSolnEx = _datastore.BySolution(_solnEx.Solution.Id);
      retrievedSolnEx.ClaimedStandard
        .Should().BeEmpty();
    }