public void ClaimedCapabilityReviewPreviousVersionMustBelongToSolution_Valid_Succeeds()
        {
            var validator = new SolutionsExValidator(_context.Object, _logger.Object, _solutionsValidator.Object);
            var soln      = Creator.GetSolutionEx();
            var review1   = Creator.GetCapabilitiesImplementedReviews();
            var review2   = Creator.GetCapabilitiesImplementedReviews(prevId: review1.Id);

            soln.ClaimedCapabilityReview = new List <CapabilitiesImplementedReviews>(new[] { review1, review2 });

            validator.ClaimedCapabilityReviewPreviousVersionMustBelongToSolution();
            var valres = validator.Validate(soln);

            valres.Errors.Should().BeEmpty();
        }
        public void ClaimedCapabilityReviewMustBelongToEvidence_Valid_Succeeds()
        {
            var validator = new SolutionsExValidator(_context.Object, _logger.Object, _solutionsValidator.Object);
            var soln      = Creator.GetSolutionEx();
            var claimEv   = Creator.GetCapabilitiesImplementedEvidence();
            var review    = Creator.GetCapabilitiesImplementedReviews(evidenceId: claimEv.Id);

            soln.ClaimedCapabilityEvidence = new List <CapabilitiesImplementedEvidence>(new[] { claimEv });
            soln.ClaimedCapabilityReview   = new List <CapabilitiesImplementedReviews>(new[] { review });

            validator.ClaimedCapabilityReviewMustBelongToEvidence();
            var valres = validator.Validate(soln);

            valres.Errors.Should().BeEmpty();
        }
        public void ClaimedCapabilityReviewPreviousVersionMustBelongToSolution_Invalid_ReturnsError()
        {
            var validator = new SolutionsExValidator(_context.Object, _logger.Object, _solutionsValidator.Object);
            var soln      = Creator.GetSolutionEx();
            var review1   = Creator.GetCapabilitiesImplementedReviews();
            var review2   = Creator.GetCapabilitiesImplementedReviews(prevId: Guid.NewGuid().ToString());

            soln.ClaimedCapabilityReview = new List <CapabilitiesImplementedReviews>(new[] { review1, review2 });

            validator.ClaimedCapabilityReviewPreviousVersionMustBelongToSolution();
            var valres = validator.Validate(soln);

            valres.Errors.Should()
            .Contain(x => x.ErrorMessage == "ClaimedCapabilityReview previous version must belong to solution")
            .And
            .HaveCount(1);
        }
        public void ClaimedCapabilityReviewMustBelongToEvidence_Invalid_ReturnsError()
        {
            var validator = new SolutionsExValidator(_context.Object, _logger.Object, _solutionsValidator.Object);
            var soln      = Creator.GetSolutionEx();
            var claimEv   = Creator.GetCapabilitiesImplementedEvidence();
            var review    = Creator.GetCapabilitiesImplementedReviews();

            soln.ClaimedCapabilityEvidence = new List <CapabilitiesImplementedEvidence>(new[] { claimEv });
            soln.ClaimedCapabilityReview   = new List <CapabilitiesImplementedReviews>(new[] { review });

            validator.ClaimedCapabilityReviewMustBelongToEvidence();
            var valres = validator.Validate(soln);

            valres.Errors.Should()
            .Contain(x => x.ErrorMessage == "ClaimedCapabilityReview must belong to evidence")
            .And
            .HaveCount(1);
        }