public void LookupUser_ShouldReturnNull()
        {
            //arrange
            var tokenManager     = new Mock <ITokenManager>();
            var authenticateUser = new AuthenticateUser(tokenManager.Object);

            //act
            var result = authenticateUser.LookupUser(new LoginModel {
                Password = "******"
            });

            //assert
            Assert.Null(result);
        }
        public void LookupUser_ShouldReturnUserModelWithExpectedBearerToken()
        {
            //arrange
            var tokenManager = new Mock <ITokenManager>();

            tokenManager.Setup(i => i.CreateToken(It.IsAny <UserModel>())).Returns("token_token_token").Verifiable();
            var authenticateUser = new AuthenticateUser(tokenManager.Object);

            //act
            var result = authenticateUser.LookupUser(new LoginModel {
                Username = "******", Password = "******"
            });

            //assert
            Assert.Equal("token_token_token", result.BearerToken);
        }
        public void LookupUser_ShouldReturnAdministratorUserModel()
        {
            //arrange
            var tokenManager = new Mock <ITokenManager>();

            tokenManager.Setup(i => i.CreateToken(It.IsAny <UserModel>())).Returns("token_token_token").Verifiable();
            var authenticateUser = new AuthenticateUser(tokenManager.Object);

            //act
            var result = authenticateUser.LookupUser(new LoginModel {
                Username = "******", Password = "******"
            });

            //assert
            Assert.True(result.IsAdministrator);
        }
        public void LookupUser_ShouldAccessTokenManagerOnce()
        {
            //arrange
            var tokenManager = new Mock <ITokenManager>();

            tokenManager.Setup(i => i.CreateToken(It.IsAny <UserModel>())).Returns("token_token_token").Verifiable();
            var authenticateUser = new AuthenticateUser(tokenManager.Object);

            //act
            var result = authenticateUser.LookupUser(new LoginModel {
                Username = "******", Password = "******"
            });

            //assert
            tokenManager.Verify(i => i.CreateToken(It.IsAny <UserModel>()), Times.Once);
        }