public void Validate_NonAdmin_Update_Returns_Error(string role) { var ctx = Creator.GetContext(role: role); _context.Setup(c => c.HttpContext).Returns(ctx); var validator = new CapabilityValidator(_context.Object); var valres = validator.Validate(new Capability(), ruleSet: nameof(ICapabilityLogic.Update)); valres.Errors.Count().Should().Be(1); }
public void Validate_Admin_Update_Returns_NoError() { var ctx = Creator.GetContext(role: Roles.Admin); _context.Setup(c => c.HttpContext).Returns(ctx); var validator = new CapabilityValidator(_context.Object); var valres = validator.Validate(new Capability(), ruleSet: nameof(ICapabilityLogic.Update)); valres.Errors.Should().BeEmpty(); }