public void ClaimedStandardMustBelongToSolution_Valid_Succeeds() { var validator = new SolutionsExValidator(_context.Object, _logger.Object, _solutionsValidator.Object); var soln = Creator.GetSolutionEx(); soln.ClaimedStandard = new List <StandardsApplicable> ( new [] { Creator.GetStandardsApplicable(solnId: soln.Solution.Id), Creator.GetStandardsApplicable(solnId: soln.Solution.Id), Creator.GetStandardsApplicable(solnId: soln.Solution.Id) } ); validator.ClaimedStandardMustBelongToSolution(); var valres = validator.Validate(soln); valres.Errors.Should().BeEmpty(); }
public void ClaimedStandardMustBelongToSolution_Invalid_ReturnsError() { var validator = new SolutionsExValidator(_context.Object, _logger.Object, _solutionsValidator.Object); var soln = Creator.GetSolutionEx(); soln.ClaimedStandard = new List <StandardsApplicable> ( new [] { Creator.GetStandardsApplicable(), Creator.GetStandardsApplicable(), Creator.GetStandardsApplicable() } ); validator.ClaimedStandardMustBelongToSolution(); var valres = validator.Validate(soln); valres.Errors.Should() .Contain(x => x.ErrorMessage == "ClaimedStandard must belong to solution") .And .HaveCount(1); }