Пример #1
0
        private bool Test(string expected, HttpContent actual)
        {
            var sut = new FormDataMatcher(expected);

            return(sut.Matches(new HttpRequestMessage(HttpMethod.Get,
                                                      "http://tempuri.org/home")
            {
                Content = actual
            }));
        }
Пример #2
0
        private bool Test(string expected, string actual)
        {
            var sut = new FormDataMatcher(expected);

            FormUrlEncodedContent content = new FormUrlEncodedContent(
                HttpHelpers.ParseQueryString(actual)
                );

            return(sut.Matches(new HttpRequestMessage(HttpMethod.Get,
                                                      "http://tempuri.org/home")
            {
                Content = content
            }));
        }
Пример #3
0
        public void Should_support_matching_dictionary_data_with_url_encoded_values2()
        {
            var data = new Dictionary <string, string>();

            data.Add("key", "Value with spaces");

            var content = new FormUrlEncodedContent(data);

            var sut = new FormDataMatcher("key=Value+with%20spaces");

            var actualMatch = sut.Matches(new HttpRequestMessage(HttpMethod.Get, "http://tempuri.org/home")
            {
                Content = content
            });

            Assert.True(actualMatch, "FormDataMatcher.Matches() should match dictionary data with URL encoded query string values.");
        }