public void GetOnSessionProperty_ReturnsAvailableSession()
        {
            // Arrange
            var context = new DefaultHttpContext();
            var session = new TestSession();
            session.Set("key1", null);
            session.Set("key2", null);
            var feature = new BlahSessionFeature();
            feature.Session = session;
            context.Features.Set<ISessionFeature>(feature);

            // Act & Assert
            Assert.Same(session, context.Session);
            context.Session.Set("key3", null);
            Assert.Equal(3, context.Session.Keys.Count());
        }
        public void SettingSession_OverridesAvailableSession()
        {
            // Arrange
            var context = new DefaultHttpContext();
            var session = new TestSession();
            session.Set("key1", null);
            session.Set("key2", null);
            var feature = new BlahSessionFeature();
            feature.Session = session;
            context.Features.Set<ISessionFeature>(feature);

            // Act
            context.Session = new TestSession();

            // Assert
            Assert.NotSame(session, context.Session);
            Assert.Empty(context.Session.Keys);
        }
Ejemplo n.º 3
0
        public void GetOnSessionProperty_ReturnsAvailableSession()
        {
            // Arrange
            var context = new DefaultHttpContext();
            var session = new TestSession();

            session.Set("key1", null);
            session.Set("key2", null);
            var feature = new BlahSessionFeature();

            feature.Session = session;
            context.Features.Set <ISessionFeature>(feature);

            // Act & Assert
            Assert.Same(session, context.Session);
            context.Session.Set("key3", null);
            Assert.Equal(3, context.Session.Keys.Count());
        }
Ejemplo n.º 4
0
        public void SettingSession_OverridesAvailableSession()
        {
            // Arrange
            var context = new DefaultHttpContext();
            var session = new TestSession();

            session.Set("key1", null);
            session.Set("key2", null);
            var feature = new BlahSessionFeature();

            feature.Session = session;
            context.Features.Set <ISessionFeature>(feature);

            // Act
            context.Session = new TestSession();

            // Assert
            Assert.NotSame(session, context.Session);
            Assert.Empty(context.Session.Keys);
        }