public void should_abort_when_authentication_fail() { Mock .Arrange(() => module_.ControlFlag) .Returns(LoginModuleControlFlag.Required); Mock .Arrange( () => module_.Login(Arg.IsAny<IAuthCallbackHandler>(), subject_)) .Returns(AuthenticationInfos.Failed()); Mock .Arrange(() => module_.Commit(Arg.IsAny<IAuthenticationInfo>())) .OccursNever(); Mock .Arrange(() => module_.Abort(Arg.IsAny<IAuthenticationInfo>())) .MustBeCalled(); var callback = new NopAuthCallbackHandler(); var context = new LoginContext(new[] {module_}); Assert.That(context.Login(subject_, callback), Is.False); Mock.Assert(module_); }
public void should_authenticate_a_valid_user() { var callback = new NopAuthCallbackHandler(); var context = new LoginContext(new[] {module_}); Assert.That(context.Login(subject_, callback), Is.True); }