private object Execute(string method, string path) { var feature = new FirstFeature(); var featureSet = new FeatureSet(null, new IFeature[] { feature }); var processor = new RequestProcessor(null, null, null, featureSet, _mockContainer, _mockSettings, _mockNegotiator ); var request = new Mock<IRequest>(); request.SetupGet(x => x.Path).Returns(new VirtualPath(path)); request.SetupGet(x => x.Method).Returns(method); var context = processor.CreateContext(request.Object, null, _mockContainer); var task = context.InvokeRequest(); task.Wait(); return task.Result; }
public async Task CanGetNewSession() { var cookies = new Dictionary<string, Cookie>(); var mockRequest = new Mock<IRequest>(); var headers = new RequestHeaders(new Dictionary<string, string[]>()); mockRequest.SetupGet(x => x.Path).Returns(new VirtualPath("~/")); mockRequest.SetupGet(x => x.Headers).Returns(headers); var mockResponse = new Mock<IResponse>(); var store = new InMemorySessionStore(); var processor = new RequestProcessor (null, store, null, new FeatureSet(null, new IFeature[0]), null, null, null); var ctx = processor.CreateContext(mockRequest.Object, mockResponse.Object, null); Assert.IsNotNull(ctx.Session); var session = await store.GetSession(ctx.Session.ID); Assert.AreSame(session, ctx.Session); Console.WriteLine(ctx.Session.ID); }