public InMemorySession(InMemorySessionStore store) { _store = store; var bytes = new byte[32]; rng.GetBytes(bytes); ID = Convert.ToBase64String(bytes); Lifetime = TimeSpan.FromMinutes(20); }
public InMemorySession(InMemorySessionStore store) { _store = store; var bytes = new byte[32]; rng.GetBytes(bytes); ID = Convert.ToBase64String(bytes); Lifetime = TimeSpan.FromMinutes(20); }
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); }