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); }
protected JObject Parm1Is101Parm2IsMostSimple1() { var parm1 = new JObject(new JProperty("value", 101)); var parm2 = new JObject(new JProperty("value", JsonRep.MostSimple1AsRef())); return(new JObject(new JProperty("parm1", parm1), new JProperty("parm2", parm2))); }
public void DoAnActionWithReferenceParameter() { var parm = new JObject(new JProperty("value", JsonRep.MostSimple1AsRef())); var parms = new JObject(new JProperty("parm2", parm)); //"parm2" is correct! TestActionInvoke("AnActionWithReferenceParameter", parms.ToString(), Methods.Post); }
protected void DoSyntacticallyMalformedParamsAsEncodedMap2() { var parm1 = new JObject(new JProperty("value", 101)); var parm2 = new JObject(new JProperty("value", JsonRep.MostSimple1AsRef())); var parms = new JObject(new JProperty("parm1", parm1), new JProperty("parm2", parm2), new JProperty("parm3", parm2)); //Additional param TestActionInvoke("AnActionReturnsObjectWithParametersAnnotatedQueryOnly", parms.ToString(), Methods.Get, Codes.SyntacticallyInvalid); }
public void DoSemanticallyMalformedParameters() { var parm1 = new JObject(new JProperty("value", "foo")); //i.e. string where it should be integer var parm2 = new JObject(new JProperty("value", JsonRep.MostSimple1AsRef())); var parms = new JObject(new JProperty("parm1", parm1), new JProperty("parm2", parm2)); TestActionInvoke(Domain.AnActionReturnsVoidWithParameters, parms.ToString(), Methods.Post, Codes.SyntacticallyInvalid); }
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 DoAnActionWithOptionalParm() { //Test with valid parm var parm = new JObject(new JProperty("value", "FOO")); var parms = new JObject(new JProperty("parm", parm)); TestActionInvoke("AnActionWithOptionalParm", parms.ToString(), Methods.Post); //Test without parm TestActionInvoke("AnActionWithOptionalParm", JsonRep.Empty(), Methods.Post); }
public void DoSyntacticallyMalformedParameters() { var parm1 = new JObject(new JProperty("value", 101)); var parm2 = new JObject(new JProperty("value", JsonRep.MostSimple1AsRef())); var parms = new JObject(new JProperty("parm1", parm1), new JProperty("param2", parm2)); //i.e. mis-named parameter TestActionInvoke(Domain.AnActionReturnsVoidWithParameters, parms.ToString(), Methods.Post, Codes.SyntacticallyInvalid); parms = new JObject(new JProperty("parm1", parm1), new JProperty("param2", parm2), new JProperty("parm3", parm2)); //i.e. additional parameter TestActionInvoke(Domain.AnActionReturnsVoidWithParameters, parms.ToString(), Methods.Post, Codes.SyntacticallyInvalid); // invalid json string invalidParms = @"{""parm1"" : {""value"" : 101} ""parm2"" : {""value"" : " + JsonRep.MostSimple1AsRef() + " }} "; // missing , parms = new JObject(new JProperty("parm1", parm1), new JProperty("param2", parm2), new JProperty("parm3", parm2)); //i.e. additional parameter TestActionInvoke(Domain.AnActionReturnsVoidWithParameters, parms.ToString(), Methods.Post, Codes.SyntacticallyInvalid); }
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 StringValidateOnlyGood() { var body = new JObject(new JProperty("value", "foo"), JsonRep.ValidateOnly()); WithValue("AStringValue", null, body.ToString(), Methods.Put, Codes.SucceededValidation); }
public void AttemptPost() { Helpers.TestResponse(objectsUrl + @"RestfulObjects.Test.Data.MostSimple/1", null, JsonRep.Empty(), Methods.Post, Codes.MethodNotValid); }
public void DoAnActionAnnotatedIdempotent() { TestActionInvoke("AnActionAnnotatedIdempotent", JsonRep.Empty(), Methods.Put); }
public void DoAttemptInvokePutActionWithGet() { TestActionInvoke("AnActionAnnotatedIdempotent", JsonRep.Empty(), Methods.Get, Codes.MethodNotValid); }
public void DoAnActionReturnsNull() { TestActionInvoke("AnActionReturnsNull", JsonRep.Empty(), Methods.Post); }
public void DoAnActionReturnsCollectionEmpty() { TestActionInvoke("AnActionReturnsCollectionEmpty", JsonRep.Empty(), Methods.Post); }
public void DoAnErrorCollection() { TestActionInvoke("AnErrorCollection", JsonRep.Empty(), Methods.Post, Codes.ServerException); }
protected void DoAnActionAnnotatedQueryOnlyReturnsNull() { TestActionInvoke("AnActionAnnotatedQueryOnlyReturnsNull", JsonRep.Empty()); }
public void DoAnActionReturnsScalar() { TestActionInvoke("AnActionReturnsScalar", JsonRep.Empty(), Methods.Post); }
public void DoAttemptInvokePostActionWithGet() { TestActionInvoke("AnAction", JsonRep.Empty(), Methods.Get, Codes.MethodNotValid); }
public void StringValidateOnlyFailRegex() { var body = new JObject(new JProperty("value", "123"), JsonRep.ValidateOnly()); WithValue("AStringValue", null, body.ToString(), Methods.Put, Codes.ValidationFailed); }
public void AttemptPropertyPost() { WithValue("AValue", null, JsonRep.Empty(), Methods.Post, Codes.MethodNotValid); }
public void DoAttemptInvokeGetActionWithPost() { // currently allowed - may need revisiting TestActionInvoke("AnActionAnnotatedQueryOnly", JsonRep.Empty(), Methods.Post); }
protected void DoAttemptPut() { Helpers.TestResponse(ResourceUrl(), null, JsonRep.Empty(), Methods.Put, Codes.MethodNotValid); }
public void DoADisabledCollectionAction() { TestActionInvoke("ADisabledCollectionAction", JsonRep.Empty(), Methods.Post, Codes.Forbidden); }
public void DoAnAction() { TestActionInvoke("AnAction", JsonRep.Empty(), Methods.Post); }
protected void DoInvokeGetActionWithPut() { // currently allowed - may need revisiting TestActionInvoke("AnActionAnnotatedQueryOnly", JsonRep.Empty(), Methods.Put); }