示例#1
0
 public void ctor_OneElement_EqualSeparatedKeyValue()
 {
     var subject = new QueryBuilder(new NameValueCollection { { "a", "b" } });
     Assert.That(subject.Query, Is.EqualTo("a=b"));
 }
示例#2
0
 public void ctor_TwoElement_EqualSeparatedKeyValuesTokenizedByAmpersand()
 {
     var subject = new QueryBuilder(new NameValueCollection { { "a", "b" }, {"c", "d"} });
     Assert.That(subject.Query, Is.EqualTo("a=b&c=d"));
 }
示例#3
0
 public void Ctor_NullCollection_EmptyQuery()
 {
     var subject = new QueryBuilder((NameValueCollection)null);
     Assert.That(subject.Query, Is.Empty);
 }
示例#4
0
        public void Ctor_EncodableValues_GetEncoded()
        {
            var subject = new QueryBuilder(new NameValueCollection { { "a", "b&b" } });

            Assert.That(subject.Query, Is.EqualTo("a=b%26b"));
        }
示例#5
0
 public void Ctor_EmptyCollection_EmptyQuery()
 {
     var subject = new QueryBuilder(new NameValueCollection());
     Assert.That(subject.Query, Is.Empty);
 }
示例#6
0
 public void Ctor_EmmptyKeys_AreNotAdded()
 {
     var subject = new QueryBuilder(new NameValueCollection { { "a", "b" }, { null, "d" } });
     Assert.That(subject.Query, Is.EqualTo("a=b"));
 }
示例#7
0
 public override byte[] GetPreloadedEntityBody()
 {
     QueryBuilder query = new QueryBuilder(_form);
     return Encoding.UTF8.GetBytes(query.Query);
 }