public void ConnectionSettings_NetworkLogging_1() { string logPath = Path.Combine ( Path.GetTempPath(), Guid.NewGuid().ToString() ) .Replace('\\', '/'); Directory.CreateDirectory(logPath); try { string connectionString = "log=" + logPath + ";"; ConnectionSettings settings = new ConnectionSettings() .ParseConnectionString(connectionString); IrbisConnection connection = new IrbisConnection(); settings.ApplyToConnection(connection); Assert.AreEqual ( typeof(LoggingClientSocket), connection.Socket.GetType() ); } finally { Directory.Delete(logPath); } }
public void ConnectionSettings_FromConnection_3() { string source = "host=127.0.0.1;port=5555;" + "database=NODB;username=john galt;password=who is;" + "workstation=A;" + "socket=" + typeof(MySocket).AssemblyQualifiedName + ";"; ConnectionSettings expected = new ConnectionSettings() .ParseConnectionString(source); IrbisConnection connection = new IrbisConnection(); expected.ApplyToConnection(connection); ConnectionSettings actual = ConnectionSettings.FromConnection(connection); Assert.AreEqual(expected.Host, connection.Host); Assert.AreEqual(expected.Port, connection.Port); Assert.AreEqual(expected.Username, connection.Username); Assert.AreEqual(expected.Password, connection.Password); Assert.AreEqual(expected.Database, connection.Database); Assert.AreEqual(expected.Workstation, connection.Workstation); string target = actual.Encode(); Assert.AreEqual(source, target); }
public void ConnectionSettings_ApplyToConnection_1() { ConnectionSettings expected = new ConnectionSettings() .ParseConnectionString(GoodConnectionString); IrbisConnection connection = new IrbisConnection(); expected.ApplyToConnection(connection); Assert.AreEqual(expected.Host, connection.Host); Assert.AreEqual(expected.Port, connection.Port); Assert.AreEqual(expected.Username, connection.Username); Assert.AreEqual(expected.Password, connection.Password); Assert.AreEqual(expected.Database, connection.Database); Assert.AreEqual(expected.Workstation, connection.Workstation); }
public void ConnectionSettings_RetryCount_1() { string connectionString = "retry=3;"; ConnectionSettings settings = new ConnectionSettings() .ParseConnectionString(connectionString); IrbisConnection connection = new IrbisConnection(); settings.ApplyToConnection(connection); Assert.AreEqual ( typeof(RetryClientSocket), connection.Socket.GetType() ); }
public void ConnectionSettings_UserData_1() { string connectionString = "userdata=hello;"; ConnectionSettings settings = new ConnectionSettings() .ParseConnectionString(connectionString); IrbisConnection connection = new IrbisConnection(); settings.ApplyToConnection(connection); Assert.AreEqual ( "hello", connection.UserData ); }
public void ConnectionSettings_FactoryTypeName_1() { string connectionString = string.Format ( "factory={0};", typeof(MyFactory).AssemblyQualifiedName ); ConnectionSettings settings = new ConnectionSettings() .ParseConnectionString(connectionString); IrbisConnection connection = new IrbisConnection(); settings.ApplyToConnection(connection); Assert.AreEqual ( typeof(MyFactory), connection.CommandFactory.GetType() ); }
public void ConnectionSettings_EngineTypeName_1() { string connectionString = string.Format ( "engine={0};", typeof(MyEngine).AssemblyQualifiedName ); ConnectionSettings settings = new ConnectionSettings() .ParseConnectionString(connectionString); IrbisConnection connection = new IrbisConnection(); settings.ApplyToConnection(connection); Assert.AreEqual ( typeof(MyEngine), connection.Executive.GetType() ); }
public void ConnectionSettings_SocketTypeName_1() { string connectionString = string.Format ( "socket={0};", typeof(MySocket).AssemblyQualifiedName ); ConnectionSettings settings = new ConnectionSettings() .ParseConnectionString(connectionString); IrbisConnection connection = new IrbisConnection(); settings.ApplyToConnection(connection); Assert.AreEqual ( typeof(MySocket), connection.Socket.GetType() ); }
public void ConnectionSettings_FromConnection_2() { string logPath = Path.Combine ( Path.GetTempPath(), Guid.NewGuid().ToString() ) .Replace('\\', '/'); Directory.CreateDirectory(logPath); try { string source = "host=127.0.0.1;port=5555;" + "database=NODB;username=john galt;password=who is;" + "workstation=A;" + "log=" + logPath + ";"; ConnectionSettings expected = new ConnectionSettings() .ParseConnectionString(source); IrbisConnection connection = new IrbisConnection(); expected.ApplyToConnection(connection); ConnectionSettings actual = ConnectionSettings.FromConnection(connection); Assert.AreEqual(expected.Host, connection.Host); Assert.AreEqual(expected.Port, connection.Port); Assert.AreEqual(expected.Username, connection.Username); Assert.AreEqual(expected.Password, connection.Password); Assert.AreEqual(expected.Database, connection.Database); Assert.AreEqual(expected.Workstation, connection.Workstation); string target = actual.Encode(); Assert.AreEqual(source, target); } finally { Directory.Delete(logPath); } }