示例#1
0
        public void LoadsSingleNullableGuidCookieUsingPropertyName()
        {
            var expected = new Guid("{6B6CB3A7-CFD7-4479-90C8-440D9F1B9F33}");
            var request  = new MockRequest
            {
                Headers = new Dictionary <string, string[]> {
                    { "Cookie", new[] { "Test=" + expected.ToString() } }
                }
            };
            var context = new MockContext {
                Request = request
            };

            var runner = new HandlerRunnerBuilder(typeof(SingleNullableGuidCookieHandler), "GET").BuildRunner();
            var target = new SingleNullableGuidCookieHandler();

            try
            {
                runner(target, context);
            }
            catch (ArgumentNullException)
            {
                // Content-type handling is going to throw an exception here.
            }
            Assert.Equal(expected, target.Test);
        }
示例#2
0
        public void LoadsSingleNullGuidCookieUsingPropertyName()
        {
            var request = new MockRequest();
            var context = new MockContext {
                Request = request
            };

            var runner = new HandlerRunnerBuilder(typeof(SingleNullableGuidCookieHandler), "GET").BuildRunner();
            var target = new SingleNullableGuidCookieHandler();

            try
            {
                runner(target, context);
            }
            catch (ArgumentNullException)
            {
                // Content-type handling is going to throw an exception here.
            }
            Assert.False(target.Test.HasValue);
        }