public void Collection_Properties_Test()
 {
     QueryStringSerializer.ToQueryString(new ArrayProperties
     {
         a = new[] { 1, 2, 3 },
         b = new[] { "x", "y", "z" },
         c = new List <bool> {
             true, false
         }
     }).Should().Be("a=1&a=2&a=3&b=x&b=y&b=z&c=true&c=false");
 }
 public void Simple_Properties_Test()
 {
     QueryStringSerializer.ToQueryString(
         new SimpleProperties
     {
         a = 5,
         b = "x y z",
         c = new DateTime(2017, 10, 20, 14, 39, 25, DateTimeKind.Utc),
         d = 10.5,
         e = 20.6F,
         f = 30.7M,
         g = true
     }).Should().Be("a=5&b=x+y+z&c=2017-10-20T14%3A39%3A25.0000000Z&d=10.5&e=20.6&f=30.7&g=true");
 }
 public void Anonymous_Objects_Serialized()
 {
     QueryStringSerializer.ToQueryString(new { a = 10, b = true, c = new[] { "x", "y" } })
     .Should().Be("a=10&b=true&c=x&c=y");
 }
 public void Non_Public_Properties_Not_Serialized()
 {
     QueryStringSerializer.ToQueryString(new PrivateProperties())
     .Should().Be("");
 }
 public void Optional_Properties_Not_Serialized()
 {
     QueryStringSerializer.ToQueryString(new OptionalProperties())
     .Should().Be("");
 }
        public void Object_Properties_Throw_InvalidOperationExcepion()
        {
            Action action = () => QueryStringSerializer.ToQueryString(new InnerObject());

            action.Should().ThrowExactly <NotSupportedException>();
        }
 public void Request_Null_Returns_Null()
 {
     QueryStringSerializer.ToQueryString(null).Should().BeNull();
 }
Пример #8
0
 public void TestInitialize()
 {
     serializer = new QueryStringSerializer();
 }