示例#1
0
        void AddGetCheck <T>(T value)
        {
            string key = "key_" + new Random().Next(50000);
            QueryStringCollection collection = new QueryStringCollection();

            collection.AddValue(key, value);

            Assert.True(collection.TryGetFirst <T>(key, out var result));
            Assert.Equal(value, result);
        }
示例#2
0
        public void DateTimeTest()
        {
            string key = "key_" + new Random().Next(50000);
            QueryStringCollection collection = new QueryStringCollection();
            DateTime time = DateTime.Now;

            collection.AddValue(key, time.ToString("o"));

            Assert.True(collection.TryGetFirst <DateTime>(key, out var result));
            Assert.Equal(time, result);
        }