public void NonWindowsLoginTest()
        {
            ConnectionSetup connectionSetup = new ConnectionSetup(hostName, "TestUser", "TestPass", false);
            connectionSetup.Timeout = 1;
            SQLServerConnector conn = new SQLServerConnector(connectionSetup);

            Assert.IsNotEmpty(conn.GetDatabaseNames());
        }
        public void DatabaseExistsTest()
        {
            ConnectionSetup connectionSetup = new ConnectionSetup(hostName, "", "", true);
            connectionSetup.Timeout = 1;
            SQLServerConnector conn = new SQLServerConnector(connectionSetup);

            Assert.Contains(dbTestName, conn.GetDatabaseNames().ToList());
        }
        public void ColumnsExistsTest()
        {
            ConnectionSetup connectionSetup = new ConnectionSetup(hostName, "", "", true);
            connectionSetup.Timeout = 1;
            SQLServerConnector conn = new SQLServerConnector(connectionSetup);

            Database db = conn.GetDatabase(dbTestName);
            DBTable personTable = db.Tables.Where(t => t.Name == "Person").First();
            string[] columnNames = personTable.Columns.Select(c => c.Name).ToArray();

            Assert.Contains("p_id", columnNames);
            Assert.Contains("FirstName", columnNames);
            Assert.Contains("LastName", columnNames);
            Assert.Contains("a_id", columnNames);
        }
        public void TablesExistsTest()
        {
            ConnectionSetup connectionSetup = new ConnectionSetup(hostName, "", "", true);
            connectionSetup.Timeout = 1;
            SQLServerConnector conn = new SQLServerConnector(connectionSetup);

            Database db = conn.GetDatabase(dbTestName);

            string[] tableNames = db.Tables.Select(t => t.Name).ToArray();

            Assert.AreEqual(4, db.Tables.Count);
            Assert.Contains("Address", tableNames);
            Assert.Contains("Person", tableNames);
            Assert.Contains("ContactInfo", tableNames);
            Assert.Contains("ContactInfoType", tableNames);
        }
        public ImportConfiguration Load()
        {
            ImportConfiguration config = null;

            using (XmlReader reader = XmlReader.Create(filePath))
            {

                ConnectionSetup connectionSetup = readConnectionSetup(reader);

                string databaseName = readDatabaseName(reader);

                ErrorHandling errorHandling = readErrorHandling(reader);

                SQLServerConnector dbConnector = new SQLServerConnector(connectionSetup);
                Database database = dbConnector.GetDatabase(databaseName);

                TableMapping[] tableMappings = readTableMappings(reader, database);

                config = new ImportConfiguration(tableMappings, connectionSetup, databaseName, errorHandling);
            }

            return config;
        }
        public void TimeoutTest()
        {
            string hostNameDoesntExist = "testest";
            ConnectionSetup connectionSetup = new ConnectionSetup(hostNameDoesntExist, "", "", true);
            connectionSetup.Timeout = 1;
            SQLServerConnector conn = new SQLServerConnector(connectionSetup);

            conn.GetDatabaseNames();
        }