public void PreviousMustBeForSameEvidence_Same_Succeeds() { var validator = new DummyReviewsValidatorBase(_reviewsDatastore.Object, _evidenceDatastore.Object, _claimDatastore.Object, _solutionDatastore.Object, _context.Object, _logger.Object); var prevReview = Creator.GetReviewsBase(); var review = Creator.GetReviewsBase(prevId: prevReview.Id, evidenceId: prevReview.EvidenceId); var prevEvidence = Creator.GetEvidenceBase(); _reviewsDatastore.Setup(x => x.ById(prevReview.Id)).Returns(prevReview); _evidenceDatastore.Setup(x => x.ById(prevReview.EvidenceId)).Returns(prevEvidence); validator.PreviousMustBeForSameEvidence(); var valres = validator.Validate(review); valres.Errors.Should().BeEmpty(); }
public void PreviousMustBeForSameEvidence_Other_ReturnsError() { var validator = new DummyReviewsValidatorBase(_reviewsDatastore.Object, _evidenceDatastore.Object, _claimDatastore.Object, _solutionDatastore.Object, _context.Object, _logger.Object); var prevReview = Creator.GetReviewsBase(); var review = Creator.GetReviewsBase(prevId: prevReview.Id); var prevEvidence = Creator.GetEvidenceBase(); _reviewsDatastore.Setup(x => x.ById(prevReview.Id)).Returns(prevReview); _evidenceDatastore.Setup(x => x.ById(prevReview.EvidenceId)).Returns(prevEvidence); validator.PreviousMustBeForSameEvidence(); var valres = validator.Validate(review); valres.Errors.Should() .ContainSingle(x => x.ErrorMessage == "Previous review must be for same evidence") .And .HaveCount(1); }