示例#1
0
        public void GetCurrentUser_returns_null_when_they_are_not_logged_in([Frozen] IIdentityReader identityReader,
                                                                            [Frozen, InMemory] IEntityData query,
                                                                            CurrentUserReader sut)
        {
            // Arrange
            Mock.Get(identityReader)
            .Setup(x => x.GetCurrentUserInfo())
            .Returns((ICurrentUserInfo)null);

            // Act
            var result = sut.GetCurrentUser();

            // Assert
            Assert.IsNull(result);
        }
示例#2
0
        public void GetCurrentUser_returns_null_when_they_are_not_found([Frozen] IIdentityReader identityReader,
                                                                        [Frozen, InMemory] IEntityData query,
                                                                        CurrentUserReader sut,
                                                                        ICurrentUserInfo userInfo,
                                                                        [HasIdentity] User user)
        {
            // Arrange
            SetupCurrentUserIdentity(user, userInfo, identityReader);

            // Act
            var result = sut.GetCurrentUser();

            // Assert
            Assert.IsNull(result);
        }
示例#3
0
        public void GetCurrentUser_returns_user_when_they_are_logged_in([Frozen] IIdentityReader identityReader,
                                                                        [Frozen, InMemory] IEntityData query,
                                                                        CurrentUserReader sut,
                                                                        ICurrentUserInfo userInfo,
                                                                        [HasIdentity] User user)
        {
            // Arrange
            FullySetupLoggedInUser(user, userInfo, query, identityReader);

            // Act
            var result = sut.GetCurrentUser();

            // Assert
            Assert.AreSame(user, result);
        }