Пример #1
0
        public static FakeHttpContext FakeHttpContextWithSession(SessionStateItemCollection sessionStateItem)
        {
            var fakeContext  = new FakeHttpContext("/", null, null, null, null, sessionStateItem);
            var fakeResponse = new FakeHttpResponseForCookieHandeling();

            fakeContext.SetResponse(fakeResponse);
            return(fakeContext);
        }
Пример #2
0
        public static FakeHttpContext FakeHttpContext()
        {
            var cookieColletion = new HttpCookieCollection();

            var fakeContext = new FakeHttpContext("/");
            var fakeRequest = new FakeHttpRequest("/", "get", new Uri("http://localhost"), new Uri("http://localhost"),
                                                  new NameValueCollection(), new NameValueCollection(), cookieColletion);

            var fakeResponse = new FakeHttpResponseForCookieHandeling();


            fakeContext.SetRequest(fakeRequest);
            fakeContext.SetResponse(fakeResponse);

            return(fakeContext);
        }
Пример #3
0
        private FakeHttpContext CreateJONCookieInFakeHttpContextWith10ItemsInside()
        {
            var cookie = new HttpCookie("JON");

            cookie["wishlistitems"] = String.Join(",", fixture.CreateMany <int>(10));

            var cookieColletion = new HttpCookieCollection();

            cookieColletion.Add(cookie);


            var fakeContext = new FakeHttpContext("/");
            var fakeRequest = new FakeHttpRequest("/", "get", new Uri("http://localhost"), new Uri("http://localhost"),
                                                  new NameValueCollection(), new NameValueCollection(), cookieColletion);

            var fakeResponse = new FakeHttpResponseForCookieHandeling();

            fakeContext.SetResponse(fakeResponse);
            fakeContext.SetRequest(fakeRequest);
            return(fakeContext);
        }