コード例 #1
0
        public void SerializeDateTimeNull()
        {
            var options = new ListOptionsWithCreated
            {
                Created = (DateTime?)null,
            };

            Assert.Equal(string.Empty, FormEncoder.CreateQueryString(options));
        }
コード例 #2
0
        public void SerializeDateTime()
        {
            var options = new ListOptionsWithCreated
            {
                Created = DateTime.Parse("Fri, 13 Feb 2009 23:31:30Z"),
            };

            Assert.Equal("created=1234567890", FormEncoder.CreateQueryString(options));
        }
コード例 #3
0
        public void SerializeDateRangeOptions()
        {
            var options = new ListOptionsWithCreated
            {
                Created = new DateRangeOptions
                {
                    GreaterThanOrEqual = DateTime.Parse("Fri, 13 Feb 2009 23:31:30Z"),
                    LessThan           = DateTime.Parse("Sun, 1 May 2044 01:28:21Z"),
                },
            };

            Assert.Equal(
                "created[gte]=1234567890&created[lt]=2345678901",
                FormEncoder.CreateQueryString(options));
        }