public void Invoke_ReturnsTrue()
        {
            // prepare
            var dataUser = new DataAccess.Models.User()
            {
                Email        = "*****@*****.**",
                PasswordSalt = "salt-generated",
                PasswordHash = "plain-hashed"
            };
            var findByResult = new List <DataAccess.Models.User>()
            {
                dataUser
            };
            var mockedUserRepository = new Mock <IUserRepository>();

            mockedUserRepository.Setup(r => r.FindBy(It.IsAny <Expression <Func <DataAccess.Models.User, bool> > >()))
            .Returns(findByResult.AsQueryable);

            var mockedHasher = new Mock <IHasher>();

            mockedHasher.Setup(h => h.CreateHash("plain", "salt-generated")).Returns("plain-hashed");

            var action = new CheckUserExist(mockedUserRepository.Object, mockedHasher.Object);

            // action
            var user = action.Invoke("*****@*****.**", "plain");

            // check
            Assert.True(user);
        }
        public void Invoke_EmptyRepository_ReturnsFalse()
        {
            // prepare
            var findByResult         = new List <DataAccess.Models.User>();
            var mockedUserRepository = new Mock <IUserRepository>();

            mockedUserRepository.Setup(r => r.FindBy(It.IsAny <Expression <Func <DataAccess.Models.User, bool> > >()))
            .Returns(findByResult.AsQueryable);
            var action = new CheckUserExist(mockedUserRepository.Object);

            // action
            var user = action.Invoke("*****@*****.**", "test");

            // check
            Assert.False(user);
        }