public void AlertWithScopeRestrictedAndRestrictionIsValid() { var alert = new Alert(); alert.Scope = Scope.Restricted; alert.Restriction = "Draft"; var restrictionValidator = new RestrictionValidator(alert); Assert.True(restrictionValidator.IsValid); }
public void AlertWithScopeDifferentFromRestrictedAndRestrictionNullIsValid() { var alert = new Alert(); alert.Scope = Scope.Public; alert.Restriction = null; var restrictionValidator = new RestrictionValidator(alert); Assert.True(restrictionValidator.IsValid); }
public void AlertWithScopeRestrictedAndRestrictionNullIsInvalid() { var alert = new Alert(); alert.Scope = Scope.Restricted; alert.Restriction = null; var restrictionValidator = new RestrictionValidator(alert); Assert.False(restrictionValidator.IsValid); var restrictionErrors = from error in restrictionValidator.Errors where error.GetType() == typeof(RestrictionError) select error; Assert.NotEmpty(restrictionErrors); }
public void AlertWithScopeDifferentFromRestrictedAndRestrictionIsInvalid() { var alert = new Alert(); alert.Scope = Scope.Public; alert.Restriction = "Draft"; var restrictionValidator = new RestrictionValidator(alert); Assert.False(restrictionValidator.IsValid); var restrictionErrors = from error in restrictionValidator.Errors where error.GetType() == typeof(RestrictionError) select error; Assert.NotEmpty(restrictionErrors); }