コード例 #1
0
        public void ParameterMessageSizeLimitReadTest()
        {
            EdmModel            model   = new EdmModel();
            ODataPayloadElement payload = TestParameters.CreateParameterValues(model, false /*fullSet*/).First();

            var testCases = new MessageSizeLimitTestCase[]
            {
                // Single byte size should fail
                new MessageSizeLimitTestCase
                {
                    MaxMessageSize = 1,
                    JsonLightSizes = new RequestResponseSizes {
                        RequestSize = 18, ResponseSize = -1
                    },
                },
                // Small number should fail
                new MessageSizeLimitTestCase
                {
                    MaxMessageSize = 10,
                    JsonLightSizes = new RequestResponseSizes {
                        RequestSize = 18, ResponseSize = -1
                    },
                },
                // Large number should work
                new MessageSizeLimitTestCase
                {
                    MaxMessageSize = 10000,
                },
                // Default should work
                new MessageSizeLimitTestCase
                {
                    MaxMessageSize = -1,
                },
            };

            this.RunAtomJsonMessageSizeLimitTests(model, payload, testCases, tc => !tc.IsRequest || tc.Format == ODataFormat.Atom);
        }