public void ClaimedStandardEvidencePreviousVersionMustBelongToSolution_Valid_Succeeds() { var validator = new SolutionsExValidator(_context.Object, _logger.Object, _solutionsValidator.Object); var soln = Creator.GetSolutionEx(); var claimEv1 = Creator.GetStandardsApplicableEvidence(); var claimEv2 = Creator.GetStandardsApplicableEvidence(prevId: claimEv1.Id); soln.ClaimedStandardEvidence = new List <StandardsApplicableEvidence>(new[] { claimEv1, claimEv2 }); validator.ClaimedStandardEvidencePreviousVersionMustBelongToSolution(); var valres = validator.Validate(soln); valres.Errors.Should().BeEmpty(); }
public void ClaimedStandardEvidencePreviousVersionMustBelongToSolution_Invalid_ReturnsError() { var validator = new SolutionsExValidator(_context.Object, _logger.Object, _solutionsValidator.Object); var soln = Creator.GetSolutionEx(); var claimEv1 = Creator.GetStandardsApplicableEvidence(); var claimEv2 = Creator.GetStandardsApplicableEvidence(prevId: Guid.NewGuid().ToString()); soln.ClaimedStandardEvidence = new List <StandardsApplicableEvidence>(new[] { claimEv1, claimEv2 }); validator.ClaimedStandardEvidencePreviousVersionMustBelongToSolution(); var valres = validator.Validate(soln); valres.Errors.Should() .Contain(x => x.ErrorMessage == "ClaimedStandardEvidence previous version must belong to solution") .And .HaveCount(1); }