public void TestPasswordMessageCreateMd5() { var salt = new byte[] { 0x77, 0x16, 0x3e, 0xe3 }; var authMessage = new AuthenticationMessage { AuthenticationMessageType = AuthenticationMessageType.MD5Password, DataBuffer = salt }; var state = PostgresClientState.CreateDefault(); var connectionString = new PostgresConnectionString( PostgresServerInformation.FakeConnectionString); var passwordMessage = PasswordMessage .CreateMd5(authMessage, state, connectionString); const string expectedHash = "md583ce447ce89d7e4e943205ff8f82f76a"; try { var actualHash = Encoding.ASCII.GetString( passwordMessage.Password, 0, passwordMessage.PasswordLength); Assert.AreEqual(0x23, passwordMessage.PasswordLength); Assert.AreEqual(expectedHash, actualHash); } finally { authMessage.TryDispose(); passwordMessage.TryDispose(); } }
public void NormalPostgresString() { //Arrange PostgresConnectionString connString = new PostgresConnectionString(); //Act connString.Value = "Server=10.211.55.2;Database=TestDb;User Id=postgres;Password=etlboxpassword;"; string withoutDbName = connString.CloneWithoutDbName().Value; string withMaster = connString.CloneWithMasterDbName().Value; string newDbName = connString.CloneWithNewDbName("test").Value; //Assert Assert.Equal("Host=10.211.55.2;Username=postgres;Password=etlboxpassword", withoutDbName); Assert.Equal("Host=10.211.55.2;Database=postgres;Username=postgres;Password=etlboxpassword", withMaster); Assert.Equal("Host=10.211.55.2;Database=test;Username=postgres;Password=etlboxpassword", newDbName); }
public PostgresConnectionManager(PostgresConnectionString connectionString) : base(connectionString) { }