public ConnectionTreeModel Load()
        {
            var connector               = DatabaseConnectorFactory.SqlDatabaseConnectorFromSettings();
            var dataProvider            = new SqlDataProvider(connector);
            var metaDataRetriever       = new SqlDatabaseMetaDataRetriever();
            var databaseVersionVerifier = new SqlDatabaseVersionVerifier(connector);
            var cryptoProvider          = new LegacyRijndaelCryptographyProvider();

            var metaData = metaDataRetriever.GetDatabaseMetaData(connector) ??
                           HandleFirstRun(metaDataRetriever, connector);
            var decryptionKey = GetDecryptionKey(metaData);

            if (!decryptionKey.Any())
            {
                throw new Exception("Could not load SQL connections");
            }

            databaseVersionVerifier.VerifyDatabaseVersion(metaData.ConfVersion);
            var dataTable      = dataProvider.Load();
            var deserializer   = new DataTableDeserializer(cryptoProvider, decryptionKey.First());
            var connectionTree = deserializer.Deserialize(dataTable);

            ApplyLocalConnectionProperties(connectionTree.RootNodes.First(i => i is RootNodeInfo));
            return(connectionTree);
        }
        public void WeCanDeserializeASingleEntry()
        {
            var dataTable = CreateDataTable(new ConnectionInfo());

            _deserializer = new DataTableDeserializer();
            var output = _deserializer.Deserialize(dataTable);

            Assert.That(output.GetRecursiveChildList().Count(), Is.EqualTo(1));
        }
        public void WeCanDeserializeATree()
        {
            var model     = CreateConnectionTreeModel();
            var dataTable = CreateDataTable(model.RootNodes[0]);

            _deserializer = new DataTableDeserializer();
            var output = _deserializer.Deserialize(dataTable);

            Assert.That(output.GetRecursiveChildList().Count(), Is.EqualTo(model.GetRecursiveChildList().Count()));
        }
        public ConnectionTreeModel Load()
        {
            var connector               = DatabaseConnectorFactory.SqlDatabaseConnectorFromSettings();
            var dataProvider            = new SqlDataProvider(connector);
            var databaseVersionVerifier = new SqlDatabaseVersionVerifier(connector);

            databaseVersionVerifier.VerifyDatabaseVersion();
            var dataTable    = dataProvider.Load();
            var deserializer = new DataTableDeserializer();

            return(deserializer.Deserialize(dataTable));
        }