public async Task SaveTreeTest()
        {
            MsSqlServer server = new MsSqlServer()
            {
                Server             = @"DESKTOP-H3A8TDA\SQLEXPRESS",
                IntegratedSecurity = true
            };

            if (!await server.TestConnectionAsync())
            {
                throw new Exception();
            }

            Database    database = new Database("northwind");
            MsSqlLoader loader   = new MsSqlLoader(server);
            await loader.LoadChildren(database);

            using (FileStream fs = new FileStream(Path, FileMode.OpenOrCreate))
            {
                fs.SetLength(0);
                DataContractSerializer saver = new DataContractSerializer(typeof(SaveData));
                saver.WriteObject(fs, new SaveData(loader, database));
            }

            Assert.IsTrue(File.Exists(Path));
        }
        private async void TestConnection()
        {
            IsBusy = true;
            MsSqlServer test = new MsSqlServer()
            {
                Server             = _server,
                Port               = _port,
                IsTcp              = _isTCP,
                InitialCatalog     = _initialCatalog,
                UserId             = _userId,
                Password           = _password,
                IntegratedSecurity = _integratedSecurity,
                ConnectionTimeout  = _connectionTimeout,
                Pooling            = _pooling
            };

            if (await test.TestConnectionAsync())
            {
                IsBusy = false;

                MessageBox.Show("Connection succsessful!", "Test Connection", MessageBoxButton.OK,
                                MessageBoxImage.Information);
            }
            else
            {
                IsBusy = false;

                MessageBox.Show("Connection failed!", "Test Connection", MessageBoxButton.OK,
                                MessageBoxImage.Warning);
            }
        }
        private async void CreateConection(ConnectionWindow window)
        {
            IsBusy = true;
            MsSqlServer server = new MsSqlServer()
            {
                Server             = _server,
                Port               = _port,
                IsTcp              = _isTCP,
                InitialCatalog     = _initialCatalog,
                UserId             = _userId,
                Password           = _password,
                IntegratedSecurity = _integratedSecurity,
                ConnectionTimeout  = _connectionTimeout,
                Pooling            = _pooling
            };

            if (await server.TestConnectionAsync())
            {
                IsBusy              = false;
                Connection          = server;
                window.DialogResult = true;
                window.Close();
            }
            else
            {
                IsBusy = false;
                MessageBox.Show("Connection failed!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        public async Task ConnectionTest()
        {
            MsSqlServer server = new MsSqlServer()
            {
                Server             = @"DESKTOP-H3A8TDA\SQLEXPRESS",
                IntegratedSecurity = true,
                InitialCatalog     = "master"
            };

            bool connectionResul = await server.TestConnectionAsync();

            Assert.IsTrue(connectionResul);
        }
        public async Task LoadProperties()
        {
            MsSqlServer server = new MsSqlServer()
            {
                Server             = @"DESKTOP-H3A8TDA\SQLEXPRESS",
                IntegratedSecurity = true
            };

            if (!await server.TestConnectionAsync())
            {
                throw new Exception();
            }

            Database database = new Database("northwind");

            MsSqlLoader loader = new MsSqlLoader(server);

            await loader.LoadProperties(database);

            Assert.IsTrue(database.Properties.Count != 0);
        }
Пример #6
0
        public async Task LoadChildrenTest()
        {
            MsSqlServer server = new MsSqlServer()
            {
                Server             = @"CTDLAPTOP\SQLEXPRESS",
                IntegratedSecurity = true
            };

            if (!await server.TestConnectionAsync())
            {
                throw new Exception();
            }

            Database database = new Database("Northwnd");

            MsSqlLoader loader = new MsSqlLoader(server);

            await loader.LoadChildren(database);

            Assert.IsTrue(database.Children.Count != 0);
        }
        public async Task LoadDescription()
        {
            MsSqlServer server = new MsSqlServer()
            {
                Server             = @"DESKTOP-H3A8TDA\SQLEXPRESS",
                IntegratedSecurity = true
            };

            if (!await server.TestConnectionAsync())
            {
                throw new Exception();
            }

            Database    database = new Database("northwind");
            MsSqlLoader loader   = new MsSqlLoader(server);
            await loader.LoadChildren(database);

            DbObject child = database.Children.First();

            new MsSqlPrinterFactory().GetPrinter(child).GetDefintition(child);


            Assert.IsTrue(!string.IsNullOrWhiteSpace(child.Definition));
        }