public void DoParameterValidateOnlyBad() { var parm = new JObject(new JProperty("value", "123")); var parms = new JObject(new JProperty("parm", parm), JsonRep.ValidateOnly()); TestActionInvoke("AnActionWithOptionalParm", parms.ToString(), Methods.Post, Codes.ValidationFailed); }
public void AttemptValidateOnlyWrongType() { var ms1 = new JProperty("MostSimple", new JObject(new JProperty("value", new JObject(new JProperty(JsonRep.Href, Urls.Objects + Urls.Immutable1))))); var name = new JProperty("Name", new JObject(new JProperty("value", null))); var body = new JObject(ms1, name, JsonRep.ValidateOnly()); Object(Urls.VerySimple2, "VerySimpleFail", body.ToString(), Methods.Put, Codes.ValidationFailed); }
public void ValidateOnlyGood() { var ms1 = new JProperty("MostSimple", new JObject(new JProperty("value", new JObject(new JProperty(JsonRep.Href, Urls.Objects + Urls.MostSimple1))))); var name = new JProperty("Name", new JObject(new JProperty("value", null))); var body = new JObject(ms1, name, JsonRep.ValidateOnly()); Object(Urls.VerySimple1, null, body.ToString(), Methods.Put, Codes.SucceededValidation); }
public void DoValidateOnlyParameters() { //Test first with valid parm var parm = new JObject(new JProperty("value", "FOO")); var parms = new JObject(new JProperty("parm", parm), JsonRep.ValidateOnly()); TestActionInvoke("AnActionWithOptionalParm", parms.ToString(), Methods.Post, Codes.SucceededValidation); //Test with invalid parm - fails Regex[A-Z] parm = new JObject(new JProperty("value", "123")); parms = new JObject(new JProperty("parm", parm), JsonRep.ValidateOnly()); TestActionInvoke("AnActionWithOptionalParm", parms.ToString(), Methods.Post, Codes.ValidationFailed); //Test with invalid parm - >101 chars parm = new JObject(new JProperty("value", "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ")); parms = new JObject(new JProperty("parm", parm), JsonRep.ValidateOnly()); TestActionInvoke("AnActionWithOptionalParm", parms.ToString(), Methods.Post, Codes.ValidationFailed); }
public void StringValidateOnlyFailRegex() { var body = new JObject(new JProperty("value", "123"), JsonRep.ValidateOnly()); WithValue("AStringValue", null, body.ToString(), Methods.Put, Codes.ValidationFailed); }
public void StringValidateOnlyGood() { var body = new JObject(new JProperty("value", "foo"), JsonRep.ValidateOnly()); WithValue("AStringValue", null, body.ToString(), Methods.Put, Codes.SucceededValidation); }