示例#1
0
        public void ToQueryStringTests()
        {
            Assert.AreEqual("name=Bob", new UserRequest {
                Name = "Bob"
            }.ToQueryString());

            var subscription = new SubscriptionRequest("merchant123", 2m, 1, "month")
            {
                StartAt = new DateTimeOffset(new DateTime(2011, 01, 01, 12, 00, 00)),
                User    = new UserRequest
                {
                    Name      = "John Smith",
                    FirstName = "John",
                }
            };

            Assert.AreEqual(
                "amount=2.00&interval_length=1&interval_unit=month&merchant_id=merchant123&start_at=2011-01-01T12%3A00%3A00Z&user%5Bfirst_name%5D=John&user%5Bname%5D=John%20Smith",
                subscription.ToQueryString());
        }