private void LoadProfiles(DatabaseVersionSetup versionSetup, IEnumerable<XElement> enumerable)
        {
            foreach (var element in enumerable)
            {
                string value = element.Attribute("id").Value;
                IRepositoryProfile profile = null;
                XElement databaseProfile = element.Element("repositoryProfile");

                KeyValuePair<string,string>[] props;
                if (databaseProfile != null)
                {
                    XElement trackingByTable = databaseProfile.Element("trackingByTable");

                    ITracker databaseTrackingTable = null;
                    if (trackingByTable != null)
                    {
                        databaseTrackingTable = new AgnosticDatabaseTrackingTable(trackingByTable.Attribute("tableName").Value, Convert.ToBoolean(trackingByTable.Attribute("autoCreate").Value));
                    }

                    var databaseProfileType = databaseProfile.Attribute("type").Value;
                    if (databaseProfileType == "sqlServer")
                    {
                       int commandTimeoutValue = 30;
                       var commandTimeoutString = databaseProfile.Attribute("commandTimeout");
                       if(commandTimeoutString != null)
                          commandTimeoutValue = int.Parse(commandTimeoutString.Value);

                        profile = new SqlServerDatabaseProfile(
                                databaseProfile.Attribute("connectionString").Value,
                                databaseProfile.Attribute("databaseName").Value,
                                databaseProfile.Attribute("repositoryID").Value,
                                commandTimeoutValue,
                                databaseTrackingTable);
                    }
                    else if (databaseProfileType == "mySql")
                    {
                        int commandTimeoutValue = 30;
                        var commandTimeoutString = databaseProfile.Attribute("commandTimeout");
                        if (commandTimeoutString != null)
                            commandTimeoutValue = int.Parse(commandTimeoutString.Value);

                        profile = new MySqlRepositoryProfile(
                                databaseProfile.Attribute("connectionString").Value,
                                databaseProfile.Attribute("databaseName").Value,
                                databaseProfile.Attribute("repositoryID").Value,
                                commandTimeoutValue,
                                databaseTrackingTable);
                    }
                    else
                    {
                        throw new Exception(string.Format("Unknown databaseProfile type {0}", databaseProfileType));
                    }
                    XElement properties = databaseProfile.Element("properties");
                    props = LoadProperties(properties);
                }
                else{
                    throw new Exception("repositoryProfile missing from profile");
                }
                var newProfile = new DatabaseVersionSetup.Profile(value,profile);
                if (props != null) newProfile.AddProperties(props);

                versionSetup.Profiles.Add(newProfile);
            }
        }
        public DatabaseVersionSetup GetVersionSetup()
        {
            var versionSetup = new DatabaseVersionSetup();
            mockSqlServerDatabaseProfile = new Mock<SqlServerDatabaseProfile>(MockBehavior.Strict, "Data Source=GMV-RW-LT;Initial Catalog=Intercontinental;Integrated Security=True"
                , "Intercontinental4"
                , "Intercontinental"
                , _mockITracker.Object);

            var profile = new DatabaseVersionSetup.Profile("Default",
                                                        mockSqlServerDatabaseProfile.Object);
            profile.AddProperties("test1", "test1Prof|withvar|${dp.DatabaseName}|");
            profile.AddProperties("test2", "test2");
            profile.AddProperties("test2", "test2|over");
            profile.AddProperties("insert", "insert.sql");
            profile.AddProperties("update", "update.sql");
            profile.AddProperties("delete", "delete.sql");
            versionSetup.Profiles.Add(profile);

            var runner = new SqlRunner("CREATE DATABASE ${dp.DatabaseName};", "USE Master; DROP DATABASE ${dp.DatabaseName};");
            var repository = new DatabaseRepository("Intercontinental", new UpdatesMetadata(1, "Todau", "Initialize", "rolf", runner));
            repository.AddProperties("test0", "test0");
            repository.AddProperties("test1", "test1");
            var versions = new UpdatesMetadata(2, "2010-04-16", "First update", "Rolf Wessels",
                new SqlRunner(
                    @"Create2 ${test0} ${test1} ${test2} ${test3}",
                    @"RoleBack2 ${test0} ${test1} ${test2} ${test3}",
                    @"TestData2 ${test0} ${test1} ${test2} ${test3}"
                    )
                );
            repository.Updates.Add(versions);

            versions = new UpdatesMetadata(3, "2010-04-16", "First update", "Rolf Wessels",
                new SqlRunner(
                    @"Create3 ${test0} ${test1} ${test2} ${test3}",
                    @"RoleBack3 ${test0} ${test1} ${test2} ${test3}",
                    @"TestData3 ${test0} ${test1} ${test2} ${test3}"
                    )
                );
            repository.Updates.Add(versions);
            File.WriteAllText(@"resources\insert.sql", @"Create4 ${test0} ${test1} ${test2} ${test3}");
            File.WriteAllText(@"resources\update.sql", @"RoleBack4 ${test0} ${test1} ${test2} ${test3}");
            File.WriteAllText(@"resources\delete.sql", @"TestData4 ${test0} ${test1} ${test2} ${test3}");
            repository.Updates.Add(new UpdatesMetadata(4, "2010-04-16", "First update", "Rolf Wessels",
                new SqlRunner(new SqlFilesExecuter(new[] { @"resources\${insert}" }),
                    new SqlFilesExecuter(new[] { @"resources\${update}" }),
                    new SqlFilesExecuter(new[] { @"resources\${delete}" }))));

            versionSetup.Repository.Add(repository);

            return versionSetup;
        }