public void TechnicalContactMustBelongToSolution_Valid_Succeeds() { var validator = new SolutionsExValidator(_context.Object, _logger.Object, _solutionsValidator.Object); var soln = Creator.GetSolutionEx(); var techCont = Creator.GetTechnicalContact(solutionId: soln.Solution.Id); soln.TechnicalContact = new List <TechnicalContacts>(new[] { techCont }); validator.TechnicalContactMustBelongToSolution(); var valres = validator.Validate(soln); valres.Errors.Should().BeEmpty(); }
public void TechnicalContactMustBelongToSolution_Invalid_ReturnsError() { var validator = new SolutionsExValidator(_context.Object, _logger.Object, _solutionsValidator.Object); var soln = Creator.GetSolutionEx(); var techCont = Creator.GetTechnicalContact(); soln.TechnicalContact = new List <TechnicalContacts>(new[] { techCont }); validator.TechnicalContactMustBelongToSolution(); var valres = validator.Validate(soln); valres.Errors.Should() .Contain(x => x.ErrorMessage == "TechnicalContact must belong to solution") .And .HaveCount(1); }