public void GivenNullUser_AbandonsSession() { var session = new FakeSession(); ConfigureSessionFromContextResolver_ToReturn(session); _sut.SetAuthenticatedUser(null); Assert.That(session.IsAbandoned); }
public void GivenNullUser_SetsNullUserInSession() { var session = new FakeSession(); ConfigureSessionFromContextResolver_ToReturn(session); _sut.SetAuthenticatedUser(null); var actual = session[Constants.SessionKeyForUser]; Assert.That(actual, Is.Null); }
public static Mock <IHttpContextAccessor> SetUpHttpContextAccessor() { Mock <IHttpContextAccessor> httpContextAccessor = new Mock <IHttpContextAccessor>(); Mock <HttpContext> context = new Mock <HttpContext>(); context.Setup(c => c.Session).Returns(new FakeSession()); FakeSession session = new FakeSession(); httpContextAccessor.Setup(a => a.HttpContext).Returns(context.Object); return(httpContextAccessor); }
public void SetsUserInSession() { var session = new FakeSession(); ConfigureSessionFromContextResolver_ToReturn(session); var user = new User(); _sut.SetAuthenticatedUser(user); var actual = session[Constants.SessionKeyForUser]; Assert.That(actual, Is.Not.Null); Assert.That(actual, Is.EqualTo(user)); }
public virtual void Setup() { Session = new FakeSession(); Cake = Session.CakeContext; var dp = new DirectoryPath("./testdata"); var d = Session.CakeContext.FileSystem.GetDirectory(dp); if (d.Exists) { d.Delete(true); } d.Create(); }
public FakeExecutionEngine(FakeSession session, object command) { }
public FakePerformanceEngine(FakeSession session, object command) { }