Пример #1
0
        public void ReturnNoData()
        { 
            var httpBaseMock = new Mock<HttpContextBase>();
            httpBaseMock.Setup(c => c.Session).Returns((HttpSessionStateBase)null);

            var contextMock = new Mock<ITabContext>();
            contextMock.Setup(c => c.GetRequestContext<HttpContextBase>()).Returns(httpBaseMock.Object);

            var request = new Session();
            var result = request.GetData(contextMock.Object);

            Assert.Null(result); 
        }
Пример #2
0
        public void ReturnData()
        {
            var sessionKeys = new NameValueCollection { { "Hello", "Fellow" }, { "World", "Jorld" } };

            var sesionMock = new Mock<HttpSessionStateBase>();
            sesionMock.Setup(r => r.Keys).Returns(sessionKeys.Keys);
            sesionMock.SetupGet(r => r.Count).Returns(2);
            sesionMock.Setup(r => r["Hello"]).Returns("Fellow");
            sesionMock.Setup(r => r["World"]).Returns("Jorld");

            var httpBaseMock = new Mock<HttpContextBase>();
            httpBaseMock.Setup(c => c.Session).Returns(sesionMock.Object);

            var contextMock = new Mock<ITabContext>();
            contextMock.Setup(c => c.GetRequestContext<HttpContextBase>()).Returns(httpBaseMock.Object);

            var request = new Session();
            var result = request.GetData(contextMock.Object);

            Assert.NotNull(result);
            Assert.NotNull(result as List<SessionModel>);
        }
Пример #3
0
        public void HaveADocumentationUri()
        {
            var request = new Session();

            Assert.False(string.IsNullOrWhiteSpace(request.DocumentationUri));
        }
Пример #4
0
 public void BeNamedSession()
 {
     var request = new Session();
     Assert.Equal("Session", request.Name);
 }
Пример #5
0
 public void UseDefaultLifeCycleSupport()
 {
     var request = new Session();
     Assert.Equal(RuntimeEvent.EndSessionAccess, request.ExecuteOn);
 }
Пример #6
0
        public void HaveProperContextObjectType()
        {
            var request = new Session();

            Assert.Equal(typeof(HttpContextBase), request.RequestContextType);
        }