public void CannotAuthenticateInvalidRepository()
        {
            // Arrange
            var repo = new AuthenticationHelper(UserControllerTest.GetMockRepo(false), GetConfiguration());

            // Act
            var result = repo.Authenticate(EmailAdmin, PassAdmin);

            // Assert
            Assert.Null(result);
        }
        public void CannotAuthenticateEmptyParameters()
        {
            // Arrange
            var repo = new AuthenticationHelper(UserControllerTest.GetMockRepo(), GetConfiguration());

            // Act
            var result = repo.Authenticate(string.Empty, string.Empty);

            // Assert
            Assert.Null(result);
        }
        public void CannotAuthenticateInvalidPassword()
        {
            // Arrange
            var repo = new AuthenticationHelper(UserControllerTest.GetMockRepo(), GetConfiguration());

            // Act
            var result = repo.Authenticate(EmailAdmin, "Not my password");

            // Assert
            Assert.Null(result);
        }
        public void CanAuthenticate()
        {
            // Arrange
            var userRepo = UserControllerTest.GetMockRepo();
            var repo     = new AuthenticationHelper(userRepo, GetConfiguration());
            var user     = userRepo.GetById(1).Value;

            // Act
            var result = repo.Authenticate(EmailAdmin, PassAdmin);

            // Assert
            Assert.NotNull(result);
            Assert.Equal(result.Id, user.Id);
            Assert.Equal(result.Name, user.Name);
            Assert.Equal(result.Surname, user.Surname);
            Assert.Equal(result.IsAdmin, user.IsAdmin);
            Assert.False(string.IsNullOrWhiteSpace(result.Token));
        }