Example #1
0
        public void get_keys_from_dictionary()
        {
            var values = new Dictionary<string, string> { { "a", "1" }, { "b", "2" }, {"c", "3"} };

            var headers = new DictionaryHeaders(values);

            headers.Keys().ShouldHaveTheSameElementsAs("a", "b", "c");
        }
Example #2
0
        public void dictionary_has()
        {
            var values = new Dictionary<string, string> { { "a", "1" }, { "b", "2" } };

            var headers = new DictionaryHeaders(values);

            headers.Has("a").ShouldBeTrue();
            headers.Has("c").ShouldBeFalse();
        }
Example #3
0
        public void get_and_set_with_dictionary()
        {
            var values = new Dictionary<string, string>{{"a", "1"}, {"b", "2"}};

            var headers = new DictionaryHeaders(values);
            headers["a"].ShouldBe("1");
            headers["b"].ShouldBe("2");

            headers["c"] = "3";

            values["c"].ShouldBe("3");
        }
Example #4
0
        public void to_name_values_for_dictionary()
        {
            var values = new Dictionary<string, string> { { "a", "1" }, { "b", "2" } };

            var headers = new DictionaryHeaders(values);

            var collection = headers.ToNameValues();
            collection["a"].ShouldBe("1");
            collection["b"].ShouldBe("2");
        }