public void Validate_Admin_Succeeds( [ValueSource(nameof(Operations))] string operation) { var ctx = Creator.GetContext(role: Roles.Admin); _context.Setup(c => c.HttpContext).Returns(ctx); var techCont = Creator.GetTechnicalContact(); var validator = new TechnicalContactValidator(_context.Object, _solutionDatastore.Object); var res = validator.Validate(techCont, ruleSet: operation); res.Errors.Should().BeEmpty(); }
public void Validate_Supplier_Other_ReturnsError( [ValueSource(nameof(Operations))] string operation) { var orgId = Guid.NewGuid().ToString(); var ctx = Creator.GetContext(orgId: orgId, role: Roles.Supplier); _context.Setup(c => c.HttpContext).Returns(ctx); var soln = Creator.GetSolution(); var techCont = Creator.GetTechnicalContact(); _solutionDatastore.Setup(x => x.ById(techCont.SolutionId)).Returns(soln); var validator = new TechnicalContactValidator(_context.Object, _solutionDatastore.Object); var res = validator.Validate(techCont, ruleSet: operation); res.Errors.Count().Should().Be(1); }