public async Task EnsureSessionIdCookieAsync_should_add_cookie()
        {
            _props.SetSessionId("999");
            _mockAuthenticationHandler.Result = AuthenticateResult.Success(new AuthenticationTicket(_user, _props, "scheme"));

            await _subject.EnsureSessionIdCookieAsync();

            var cookieContainer = new CookieContainer();
            var cookies         = _mockHttpContext.HttpContext.Response.Headers.Where(x => x.Key.Equals("Set-Cookie", StringComparison.OrdinalIgnoreCase)).Select(x => x.Value);

            cookieContainer.SetCookies(new Uri("http://server"), string.Join(",", cookies));
            _mockHttpContext.HttpContext.Response.Headers.Clear();

            var cookie = cookieContainer.GetCookies(new Uri("http://server")).Cast <Cookie>().Where(x => x.Name == _options.Authentication.CheckSessionCookieName).FirstOrDefault();

            cookie.Value.Should().Be("999");
        }
        public async Task EnsureSessionIdCookieAsync_should_add_cookie()
        {
            _stubAuthHandler.User = _user;
            _stubAuthHandler.Properties.Add(DefaultUserSession.SessionIdKey, "999");

            await _subject.EnsureSessionIdCookieAsync();

            var cookieContainer = new CookieContainer();
            var cookies         = _mockHttpContext.HttpContext.Response.Headers.Where(x => x.Key.Equals("Set-Cookie", StringComparison.OrdinalIgnoreCase)).Select(x => x.Value);

            cookieContainer.SetCookies(new Uri("http://server"), string.Join(",", cookies));
            _mockHttpContext.HttpContext.Response.Headers.Clear();

            var cookie = cookieContainer.GetCookies(new Uri("http://server")).Cast <Cookie>().Where(x => x.Name == _options.Authentication.CheckSessionCookieName).FirstOrDefault();

            cookie.Value.Should().Be("999");
        }