Ejemplo n.º 1
0
        public void Can_set_values_with_default_indexer()
        {
            var session = new FakeHttpSessionState();
            session["name"] = "slim";

            Assert.That(session["name"], Is.EqualTo("slim"));
        }
Ejemplo n.º 2
0
        public void Can_set_values_with_default_indexer()
        {
            var session = new FakeHttpSessionState();

            session["name"] = "slim";

            Assert.That(session["name"], Is.EqualTo("slim"));
        }
Ejemplo n.º 3
0
        public void Should_add_values_to_session()
        {
            var session = new FakeHttpSessionState {
                { "color", "red" }
            };

            Assert.That(session["color"], Is.EqualTo("red"));
        }
Ejemplo n.º 4
0
        public void Can_initialize_context_with_existing_session()
        {
            var session = new FakeHttpSessionState();

            var context = new FakeHttpContext(session: session);

            Assert.That(context.Session, Is.SameAs(session));
        }
 public void SetUp()
 {
     _expectedItem = DateTime.Now;
     _session      = new FakeHttpSessionState();
     _session[ExpectedSessionKey]      = _expectedItem;
     _session["anotherSessionItem"]    = Guid.NewGuid();
     _session["yetAnotherSessionItem"] = Guid.NewGuid();
 }
Ejemplo n.º 6
0
        public void Can_initialize_context_with_existing_session()
        {
            var session = new FakeHttpSessionState();

            var context = new FakeHttpContext(session: session);

            Assert.That(context.Session, Is.SameAs(session));
        }
 internal static IDictionary <string, object> ToDictionary(
     this FakeHttpSessionState state
     )
 {
     return(state.Keys.AsEnumerable().Aggregate(new List <KeyValuePair <string, object> >(),
                                                (acc, cur) =>
     {
         acc.Add(new KeyValuePair <string, object>(cur, state[cur]));
         return acc;
     }).ToDictionary(kvp => kvp.Key, kvp => kvp.Value));
 }
        private void InitializeSession()
        {
            System.Web.HttpContext.Current = new System.Web.HttpContext(workerRequest);
            System.Web.HttpContext.Current.Items.Clear();
            var fakeHttpSessionState = new FakeHttpSessionState();

            System.Web.SessionState.HttpSessionState session = (System.Web.SessionState.HttpSessionState)ReflectionHelper.Instantiate(typeof(System.Web.SessionState.HttpSessionState), new Type[] { typeof(IHttpSessionState) }, fakeHttpSessionState);
            Context = new HttpContext(new BaseWrapped.SimulatedHttpRequest(workerRequest),
                                      new HttpSessionState(fakeHttpSessionState),
                                      new BaseWrapped.HttpServerUtility(new ConfigMapPath(this)));

            System.Web.HttpContext.Current.Items.Add("AspSession", session);
        }
Ejemplo n.º 9
0
        public void SetUp()
        {
            var collection = new FakeHttpSessionState();

            _session = collection;
        }
Ejemplo n.º 10
0
 public void SetUp()
 {
     _session = new FakeHttpSessionState();
 }
 public ExceptionWithDataBuilderTests()
 {
     _mockRequest      = new Mock <HttpRequestWrapper>(new HttpRequest("", "http://localhost", ""));
     _mockSessionState = FakeHttpSessionState.Build();
     _exception        = new Exception();
 }
Ejemplo n.º 12
0
        public void Should_add_values_to_session()
        {
            var session = new FakeHttpSessionState { { "color", "red" } };

            Assert.That(session["color"], Is.EqualTo("red"));
        }