public void ReturnsNullWhenTheUserDoesntExist()
        {
            var store = A.Fake<IDataStore>();

            A.CallTo(() => store.FindOneByNamedQuery(null, null)).WithAnyArguments().Returns(null);
            var user = new UserRepository(store, null).FindByCredentials(null, null);
            Assert.IsNull(user);
        }
        public void ReturnsNullIfThePasswordsDontMatch()
        {
            var store = A.Fake<IDataStore>();
            var encryption = A.Fake<IEncryption>();

            A.CallTo(() => encryption.CheckPassword(null, null)).WithAnyArguments().Returns(false);
            var user = new UserRepository(store, encryption).FindByCredentials(null, null);

            Assert.IsNull(user);
        }
        public void ReturnTheValidUser()
        {
            var store = A.Fake<IDataStore>();
            var encryption = A.Fake<IEncryption>();
            var expected = new User();

            Any.CallTo(store).WithReturnType<User>().Returns(expected);
            Any.CallTo(encryption).WithReturnType<bool>().Returns(true);
            var user = new UserRepository(store, encryption).FindByCredentials(null, null);

            Assert.AreSame(expected, user);
        }