public void ClaimedCapabilityEvidencePreviousVersionMustBelongToSolution_Valid_Succeeds()
        {
            var validator = new SolutionsExValidator(_context.Object, _logger.Object, _solutionsValidator.Object);
            var soln      = Creator.GetSolutionEx();
            var claimEv1  = Creator.GetCapabilitiesImplementedEvidence();
            var claimEv2  = Creator.GetCapabilitiesImplementedEvidence(prevId: claimEv1.Id);

            soln.ClaimedCapabilityEvidence = new List <CapabilitiesImplementedEvidence>(new[] { claimEv1, claimEv2 });

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

            valres.Errors.Should().BeEmpty();
        }
Пример #2
0
        public void SolutionMustBeInReview_Review_Succeeds(SolutionStatus status)
        {
            var validator = new CapabilitiesImplementedEvidenceValidator(_evidenceDatastore.Object, _claimDatastore.Object, _solutionDatastore.Object, _context.Object, _logger.Object);
            var soln      = Creator.GetSolution(status: status);
            var claim     = Creator.GetCapabilitiesImplemented(solnId: soln.Id);
            var evidence  = Creator.GetCapabilitiesImplementedEvidence(claimId: claim.Id);

            _claimDatastore.As <IClaimsDatastore <ClaimsBase> >().Setup(x => x.ById(evidence.ClaimId)).Returns(claim);
            _solutionDatastore.Setup(x => x.ById(soln.Id)).Returns(soln);

            validator.SolutionMustBeInReview();
            var valres = validator.Validate(evidence);

            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 ClaimedCapabilityEvidencePreviousVersionMustBelongToSolution_Invalid_ReturnsError()
        {
            var validator = new SolutionsExValidator(_context.Object, _logger.Object, _solutionsValidator.Object);
            var soln      = Creator.GetSolutionEx();
            var claimEv1  = Creator.GetCapabilitiesImplementedEvidence();
            var claimEv2  = Creator.GetCapabilitiesImplementedEvidence(prevId: Guid.NewGuid().ToString());

            soln.ClaimedCapabilityEvidence = new List <CapabilitiesImplementedEvidence>(new[] { claimEv1, claimEv2 });

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

            valres.Errors.Should()
            .Contain(x => x.ErrorMessage == "ClaimedCapabilityEvidence previous version must belong to solution")
            .And
            .HaveCount(1);
        }
Пример #5
0
        public void SolutionMustBeInReview_NonReview_ReturnsError(SolutionStatus status)
        {
            var validator = new CapabilitiesImplementedEvidenceValidator(_evidenceDatastore.Object, _claimDatastore.Object, _solutionDatastore.Object, _context.Object, _logger.Object);
            var soln      = Creator.GetSolution(status: status);
            var claim     = Creator.GetCapabilitiesImplemented(solnId: soln.Id);
            var evidence  = Creator.GetCapabilitiesImplementedEvidence(claimId: claim.Id);

            _claimDatastore.As <IClaimsDatastore <ClaimsBase> >().Setup(x => x.ById(evidence.ClaimId)).Returns(claim);
            _solutionDatastore.Setup(x => x.ById(soln.Id)).Returns(soln);

            validator.SolutionMustBeInReview();
            var valres = validator.Validate(evidence);

            valres.Errors.Should()
            .ContainSingle(x => x.ErrorMessage == "Can only add evidence if solution is in review")
            .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);
        }