public void ClaimedStandardEvidenceMustBelongToClaim_Valid_Succeeds() { var validator = new SolutionsExValidator(_context.Object, _logger.Object, _solutionsValidator.Object); var soln = Creator.GetSolutionEx(); var claim = Creator.GetStandardsApplicable(); var claimEv = Creator.GetStandardsApplicableEvidence(claimId: claim.Id); soln.ClaimedStandard = new List <StandardsApplicable>(new [] { claim }); soln.ClaimedStandardEvidence = new List <StandardsApplicableEvidence>(new[] { claimEv }); validator.ClaimedStandardEvidenceMustBelongToClaim(); var valres = validator.Validate(soln); valres.Errors.Should().BeEmpty(); }
public void ClaimedStandardEvidenceMustBelongToClaim_Invalid_ReturnsError() { var validator = new SolutionsExValidator(_context.Object, _logger.Object, _solutionsValidator.Object); var soln = Creator.GetSolutionEx(); var claim = Creator.GetStandardsApplicable(); var claimEv = Creator.GetStandardsApplicableEvidence(); soln.ClaimedStandard = new List <StandardsApplicable>(new [] { claim }); soln.ClaimedStandardEvidence = new List <StandardsApplicableEvidence>(new[] { claimEv }); validator.ClaimedStandardEvidenceMustBelongToClaim(); var valres = validator.Validate(soln); valres.Errors.Should() .Contain(x => x.ErrorMessage == "ClaimedStandardEvidence must belong to claim") .And .HaveCount(1); }