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);
            }
Пример #3
0
        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();
        }
Пример #6
0
 public FakeExecutionEngine(FakeSession session, object command)
 {
 }
Пример #7
0
 public FakePerformanceEngine(FakeSession session, object command)
 {
 }
            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 void GivenNullUser_SetsNullUserInSession()
            {
                var session = new FakeSession();
                ConfigureSessionFromContextResolver_ToReturn(session);

                _sut.SetAuthenticatedUser(null);
                var actual = session[Constants.SessionKeyForUser];

                Assert.That(actual, Is.Null);
            }
            public void GivenNullUser_AbandonsSession()
            {
                var session = new FakeSession();
                ConfigureSessionFromContextResolver_ToReturn(session);

                _sut.SetAuthenticatedUser(null);

                Assert.That(session.IsAbandoned);
            }