Esempio n. 1
0
        public void CreateConnectionStrings()
        {
            var results = OdbcWidget.ListDataSourceNames();

            foreach (var dsn in results)
            {
                var result = OdbcWidget.CreateConnectionString(dsn, "Satch", "Guitar+1", "DataCompression=True");

                Assert.AreEqual(result,
                                string.Format("DSN={0};uid=Satch;pwd=Guitar+1;DataCompression=True", dsn));
            }

            foreach (var dsn in results)
            {
                var result = OdbcWidget.CreateConnectionString(dsn, "Satch", "Guitar+1");

                Assert.AreEqual(result,
                                string.Format("DSN={0};uid=Satch;pwd=Guitar+1;", dsn));
            }

            foreach (var dsn in results)
            {
                var result = OdbcWidget.CreateConnectionString(dsn);

                Assert.AreEqual(result,
                                string.Format("DSN={0};", dsn));
            }
        }
Esempio n. 2
0
        public void TestConnection()
        {
            var validConnStr = OdbcWidget.CreateConnectionString("DPI_Test", "S_RSETATST", "y3nsrrhb1", "DataCompression=True");

            bool result = OdbcWidget.TestConnection(validConnStr);

            Assert.IsTrue(result);

            validConnStr = OdbcWidget.CreateConnectionString("Triad");

            result = OdbcWidget.TestConnection(validConnStr);

            Assert.IsTrue(result);

            var invalidConnStr = OdbcWidget.CreateConnectionString("bogusDsn", "foo", "bar");

            result = OdbcWidget.TestConnection(invalidConnStr, 2);

            Assert.IsFalse(result);
        }