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); }
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>); }
public void HaveADocumentationUri() { var request = new Session(); Assert.False(string.IsNullOrWhiteSpace(request.DocumentationUri)); }
public void BeNamedSession() { var request = new Session(); Assert.Equal("Session", request.Name); }
public void UseDefaultLifeCycleSupport() { var request = new Session(); Assert.Equal(RuntimeEvent.EndSessionAccess, request.ExecuteOn); }
public void HaveProperContextObjectType() { var request = new Session(); Assert.Equal(typeof(HttpContextBase), request.RequestContextType); }