Ejemplo n.º 1
0
        public void Merge_JsonQueryWithJsonFormParameter()
        {
            // Arrange
            var fakeRequest = new FakeRawHttpRequest("{\"a\":\"1\"}", "{\"b\":\"2\"}");

            // Act
            var data = this.requestParser.GetData(fakeRequest);

            // Assert
            Assert.AreEqual(new JObject { { "a", "1" }, { "b", "2" } }, data);
        }
Ejemplo n.º 2
0
        public void Merge_ParamQueryStringWithParamFormOverwrite()
        {
            // Arrange
            var fakeRequest = new FakeRawHttpRequest("a=1&b=2", "a=3&b=4");

            // Act
            var data = this.requestParser.GetData(fakeRequest);

            // Assert
            Assert.AreEqual(new JObject { { "a", "3" }, { "b", "4" } }, data);
        }
Ejemplo n.º 3
0
        public void Parse_JsonQueryStringOneParameter()
        {
            // Arrange
            var fakeRequest = new FakeRawHttpRequest("{\"a\":\"1\"}", string.Empty);

            // Act
            var data = this.requestParser.GetData(fakeRequest);

            // Assert
            Assert.AreEqual(new JObject { { "a", "1" } }, data);
        }
Ejemplo n.º 4
0
        public void Parse_JsonQueryStringArrayParameter()
        {
            // Arrange
            var fakeRequest = new FakeRawHttpRequest("[{\"a\":\"1\"},{\"b\":\"2\"}]", string.Empty);

            // Act
            var data = this.requestParser.GetData(fakeRequest);

            // Assert
            Assert.AreEqual(1, data.Properties().Count());
            Assert.AreEqual(
                new JArray { new JObject { { "a", "1" } }, new JObject { { "b", "2" } } },
                data[data.Properties().First().Name]);
        }
Ejemplo n.º 5
0
        public void Parse_ParamQueryStringTwoParameter()
        {
            // Arrange
            var fakeRequest = new FakeRawHttpRequest("a=1&b=2", string.Empty);

            // Act
            var data = this.requestParser.GetData(fakeRequest);

            // Assert
            Assert.AreEqual(new JObject { { "a", "1" }, { "b", "2" } }, data);
        }