Пример #1
0
        public void Explode()
        {
            var sut = new Explode <MyClass>(new MyClass());

            var dict = sut.ToDictionary(x => x.Key, x => x.Value);

            Assert.AreEqual(3, dict.Count);
            Assert.AreEqual(1, dict["Foo"]);
            Assert.AreEqual("bar", dict["Bar"]);
            Assert.AreEqual(Date, dict["Foobar"]);

            var rfc = new Runtime();

            var expected = "?Foo=1&Bar=bar&Foobar=" + Uri.EscapeDataString(Date.ToString("o"));

            var text = rfc.Expand("{?foo*}", new Dictionary <string, object> {
                { "foo", sut }
            });

            Assert.AreEqual(expected, text);
        }