public void Given_empty_escapedString_when_formatting_should_return_empty_string()
        {
            IEnumerable <KeyValuePair <string, IEnumerable <string> > > items = DataEscapingHelper.Parse("");

            // Act
            string actual = DataEscapingHelper.Format(items);

            // Assert
            actual.Should().BeEmpty();
        }
        public void Given_escapedString_contains_multiple_same_keys_when_formatting_should_produce_correct_string()
        {
            var items = new Dictionary <string, IEnumerable <string> >
            {
                { "key", new[] { "value", "$%^&*", "another value" } }
            };
            const string expected = "key=value&key=%24%25%5E%26%2A&key=another%20value";

            // Act
            string actual = DataEscapingHelper.Format(items);

            // Assert
            actual.Should().BeEquivalentTo(expected);
        }
        public void Given_escapedString_contains_variation_of_keys_with_or_without_value_when_parsing_should_return_keys_with_correct_values()
        {
            const string dataEscapedString = "key1&key2=value&key3=&key4=value1&key4=value2";
            var          expected          = new Dictionary <string, IEnumerable <string> >
            {
                { "key1", new string[0] },
                { "key2", new [] { "value" } },
                { "key3", new [] { "" } },
                { "key4", new [] { "value1", "value2" } },
            };

            // Act
            var actual = DataEscapingHelper.Parse(dataEscapedString).ToList();

            // Assert
            actual.Should().BeEquivalentTo(expected);
            DataEscapingHelper.Format(actual).Should().BeEquivalentTo(dataEscapedString);
        }