Beispiel #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotLogAuthenticationIfFlagSaysNo() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldNotLogAuthenticationIfFlagSaysNo()
        {
            // Given
            _manager.shutdown();
            _manager = CreateAuthManager(false);

            Users.create(NewUser("jake", "abc123", false));
            _manager.start();
            SetMockAuthenticationStrategyResult("jake", "abc123", AuthenticationResult.SUCCESS);

            // When
            AuthenticationResult result = _manager.login(authToken("jake", "abc123")).subject().AuthenticationResult;

            // Then
            assertThat(result, equalTo(AuthenticationResult.SUCCESS));
            _logProvider.assertNone(Info("[jake]: logged in"));
        }
Beispiel #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldFindAndAuthenticateUserSuccessfully() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldFindAndAuthenticateUserSuccessfully()
        {
            // Given
            Users.create(NewUser("jake", "abc123", false));
            _manager.start();
            SetMockAuthenticationStrategyResult("jake", "abc123", AuthenticationResult.SUCCESS);

            // When
            AuthenticationResult result = _manager.login(authToken("jake", "abc123")).subject().AuthenticationResult;

            // Then
            assertThat(result, equalTo(AuthenticationResult.SUCCESS));
            _logProvider.assertExactly(Info("[jake]: logged in"));
        }