public void ClaimedCapabilityEvidenceMustBelongToClaim_Valid_Succeeds() { var validator = new SolutionsExValidator(_context.Object, _logger.Object, _solutionsValidator.Object); var soln = Creator.GetSolutionEx(); var claim = Creator.GetCapabilitiesImplemented(); var claimEv = Creator.GetCapabilitiesImplementedEvidence(claimId: claim.Id); soln.ClaimedCapability = new List <CapabilitiesImplemented>(new [] { claim }); soln.ClaimedCapabilityEvidence = new List <CapabilitiesImplementedEvidence>(new[] { claimEv }); validator.ClaimedCapabilityEvidenceMustBelongToClaim(); var valres = validator.Validate(soln); valres.Errors.Should().BeEmpty(); }
public void ClaimedCapabilityEvidenceMustBelongToClaim_Invalid_ReturnsError() { var validator = new SolutionsExValidator(_context.Object, _logger.Object, _solutionsValidator.Object); var soln = Creator.GetSolutionEx(); var claim = Creator.GetCapabilitiesImplemented(); var claimEv = Creator.GetCapabilitiesImplementedEvidence(); soln.ClaimedCapability = new List <CapabilitiesImplemented>(new [] { claim }); soln.ClaimedCapabilityEvidence = new List <CapabilitiesImplementedEvidence>(new[] { claimEv }); validator.ClaimedCapabilityEvidenceMustBelongToClaim(); var valres = validator.Validate(soln); valres.Errors.Should() .Contain(x => x.ErrorMessage == "ClaimedCapabilityEvidence must belong to claim") .And .HaveCount(1); }