示例#1
0
        public void IfModifiedSinceHeaderNotAddedWithNullArguments()
        {
            EnsureHeader.IfModifiedSince <Class>(Box, null);
            Assert.IsFalse(Box.Headers.ContainsKey("If-Modified-Since"));

            EnsureHeader.IfModifiedSince <Class>(Box, new RestFindOptions <Class> {
                IfModifiedSince = null
            });
            Assert.IsFalse(Box.Headers.ContainsKey("If-Modified-Since"));
        }
示例#2
0
        public void IfModifiedSinceHeaderAddedWithValidArgument()
        {
            var challenge = DateTime.Now;

            Box.Headers = null;

            EnsureHeader.IfModifiedSince <Class>(Box, new RestFindOptions <Class> {
                IfModifiedSince = challenge
            });

            Assert.IsTrue(Box.Headers.ContainsKey("If-Modified-Since"));

            var ifModifiedSince = DateTime.ParseExact(Box.Headers["If-Modified-Since"],
                                                      CultureInfo.CurrentCulture.DateTimeFormat.RFC1123Pattern, CultureInfo.CurrentCulture);

            Assert.AreEqual(challenge.ToLongDateString(), ifModifiedSince.ToLongDateString());
        }