示例#1
0
        public void SolutionMustBeInReview_Review_Succeeds(SolutionStatus status)
        {
            var validator = new CapabilitiesImplementedReviewsValidator(_reviewsDatastore.Object, _evidenceDatastore.Object, _claimDatastore.Object, _solutionDatastore.Object, _context.Object, _logger.Object);
            var soln      = Creator.GetSolution(status: status);
            var review    = GetCapabilitiesImplementedReview();
            var claim     = Creator.GetCapabilitiesImplemented(solnId: soln.Id);
            var evidence  = Creator.GetCapabilitiesImplementedEvidence(claimId: claim.Id);

            _evidenceDatastore.As <IEvidenceDatastore <EvidenceBase> >().Setup(x => x.ById(review.EvidenceId)).Returns(evidence);
            _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(review);

            valres.Errors.Should().BeEmpty();
        }
示例#2
0
        public void SolutionMustBeInReview_NonReview_ReturnsError(SolutionStatus status)
        {
            var validator = new CapabilitiesImplementedReviewsValidator(_reviewsDatastore.Object, _evidenceDatastore.Object, _claimDatastore.Object, _solutionDatastore.Object, _context.Object, _logger.Object);
            var soln      = Creator.GetSolution(status: status);
            var review    = GetCapabilitiesImplementedReview();
            var claim     = Creator.GetCapabilitiesImplemented(solnId: soln.Id);
            var evidence  = Creator.GetCapabilitiesImplementedEvidence(claimId: claim.Id);

            _evidenceDatastore.As <IEvidenceDatastore <EvidenceBase> >().Setup(x => x.ById(review.EvidenceId)).Returns(evidence);
            _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(review);

            valres.Errors.Should()
            .ContainSingle(x => x.ErrorMessage == "Can only add evidence if solution is in review")
            .And
            .HaveCount(1);
        }