public void Authenticate_should_check_that_user_and_matching_password_exist_in_repository() { formsAuthentication.Stub(x => x.HashPasswordForStoringInConfigFile("foo")).Return("bar"); var user = new User { Email = "*****@*****.**", Password = "******", IsEnabled = true }; userRepository.Stub(r => r.GetAll()).Return(new[] { user }.AsQueryable()); var isAuthenticated = userService.Authenticate("*****@*****.**", "foo"); Assert.That(isAuthenticated, Is.True); }
protected static void SetUserAsBeingSignedInWithUsername(string name) { formsAuthentication = MockRepository.GenerateMock<IFormsAuthentication>(); formsAuthentication.Stub(x => formsAuthentication.IsCurrentlySignedIn).Return(true); formsAuthentication.Stub(x => formsAuthentication.SignedInUserName).Return(name); }