public void login_with_default_credentials_and_retrieve_a_resource()
        {
            // create the auth ticket
            var now = DateTime.Now;
            var ticket = new AuthenticationTicket
            {
                Expiration = now.AddDays(1),
                LastAccessed = now,
                UserName = "fubu"
            };

            var writer = new CookieWriter();
            Container
                .With(typeof (IOutputWriter), writer)
                .GetInstance<CookieTicketSource>()
                .Persist(ticket);

            var cookie = writer.Cookie;

            Scenario(_ =>
            {
                _.Get.Input<TargetModel>();
                _.Request.Accepts("text/json").ContentType(MimeType.HttpFormMimetype);

                _.Request.AppendCookie(cookie);

                _.StatusCodeShouldBeOk();
            });
            /*
            var response = endpoints.GetByInput(new TargetModel(), acceptType: "text/json", configure: r => {
                var cookies = new CookieContainer();
                cookies.Add(new System.Net.Cookie
                {
                    Domain = "localhost",
                    Path = cookie.Path,
                    Expires = now.AddDays(1),
                    Name = cookie.States.Single().Name,
                    Value = cookie.Value
                });

                r.CookieContainer = cookies;
                r.AllowAutoRedirect = false;
            });

            response.StatusCode.ShouldBe(HttpStatusCode.OK);
            */
        }
        public void login_with_default_credentials_and_retrieve_a_resource()
        {
            // create the auth ticket
            var now = DateTime.Now;
            var ticket = new AuthenticationTicket
                         {
                             Expiration = now.AddDays(1),
                             LastAccessed = now,
                             UserName = "fubu"
                         };

            var writer = new CookieWriter();
            Container
                .With(typeof(IOutputWriter), writer)
                .GetInstance<CookieTicketSource>()
                .Persist(ticket);

            var cookie = writer.Cookie;

            var response = endpoints.GetByInput(new TargetModel(), acceptType: "text/json", configure: r =>
            {
                var cookies = new CookieContainer();
                cookies.Add(new Cookie
                                 {
                                     Domain = "localhost",
                                     Path = cookie.Path,
                                     Expires = cookie.Expires,
                                     Name = cookie.Name,
                                     Value = cookie.Value
                                 });

                r.CookieContainer = cookies;
                r.AllowAutoRedirect = false;
            });

            response.StatusCode.ShouldEqual(HttpStatusCode.OK);
        }