public void When_InValid_Credentials_Provided_Authenticate_Returns_False2() { var authenticator = new CramMd5Mechanism(_ioService, "authenticated", "wrongpass", new DefaultTranscoder()); _ioService.SaslMechanism = authenticator; foreach (var connection in _ioService.ConnectionPool.Connections) { var isAuthenticated = authenticator.Authenticate(connection); Assert.IsFalse(isAuthenticated); } }
public void When_Valid_Credentials_Provided_Authenticate_Returns_True() { var authenticator = new CramMd5Mechanism(_ioService, new DefaultTranscoder()); _ioService.SaslMechanism = authenticator; foreach (var connection in _ioService.ConnectionPool.Connections) { var isAuthenticated = authenticator.Authenticate(connection, "authenticated", "secret"); Assert.IsTrue(isAuthenticated); } }
public void When_Valid_Credentials_Provided_Authenticate_Returns_True2() { var authenticator = new CramMd5Mechanism(_ioStrategy, "authenticated", "secret", new ManualByteConverter()); _ioStrategy.ConnectionPool.Initialize(); _ioStrategy.SaslMechanism = authenticator; foreach (var connection in _ioStrategy.ConnectionPool.Connections) { var isAuthenticated = authenticator.Authenticate(connection); Assert.IsTrue(isAuthenticated); } }
public void When_Bucket_Has_No_Password_And_Password_Is_Null_Authenticate_Succeeds() { var authenticator = new CramMd5Mechanism(_ioService, "default", null, new DefaultTranscoder()); _ioService.ConnectionPool.Initialize(); _ioService.SaslMechanism = authenticator; foreach (var connection in _ioService.ConnectionPool.Connections) { var isAuthenticated = authenticator.Authenticate(connection); Assert.IsTrue(isAuthenticated); } }
public void When_IOException_Occurs_Authenticate_Throws_Exception() { var authenticator = new CramMd5Mechanism(_ioService, "default", string.Empty, new DefaultTranscoder()); _ioService.ConnectionPool.Initialize(); var connection = _ioService.ConnectionPool.Acquire(); connection.Socket.Disconnect(false); Assert.Throws<SocketException>(() => authenticator.Authenticate(connection)); }
public void When_Bucket_Has_No_Password_Authenticate_Succeeds() { var authenticator = new CramMd5Mechanism(_ioStrategy, "default", string.Empty, new DefaultTranscoder()); _ioStrategy.ConnectionPool.Initialize(); foreach (var connection in _ioStrategy.ConnectionPool.Connections) { var isAuthenticated = authenticator.Authenticate(connection); Assert.IsTrue(isAuthenticated); } }
public void When_IOException_Occurs_Authenticate_Throws_Exception() { var authenticator = new CramMd5Mechanism(_ioStrategy, "default", string.Empty, new ManualByteConverter()); _ioStrategy.ConnectionPool.Initialize(); var connection = _ioStrategy.ConnectionPool.Acquire(); connection.Socket.Disconnect(false); authenticator.Authenticate(connection); }