Ejemplo n.º 1
0
        private async Task Update(DatabaseSetting dbSetting, DvcsScriptRepositoryBase.RevisionIdentifierBase sourceChangeset)
        {
            ICollection <BuildItem> buildItems;

            using (var connection = new SqlConnection(dbSetting.ConnectionString))
            {
                await connection.OpenAsync();

                using (var transaction = connection.BeginTransaction())
                {
                    var fileSystem     = new FileSystem();
                    var db             = dbSetting.Create(connection, transaction);
                    var gitProcess     = new ExternalProcess(pathToGit.FullName);
                    var dvcsScriptRepo = new GitScriptRepository(dbSetting.ScriptsPath, dbSetting.ServerName, dbSetting.DatabaseName, gitProcess, fileSystem, sqlParser, new ConsoleLogger(SeverityLevel.Warning), false);
                    dvcsScriptRepo.SourceChangeset = sourceChangeset;

                    buildItems = await db.GetChangedBuildItemsAsync(dvcsScriptRepo);

                    transaction.Commit();
                }
            }

            await DispatcherInvoke(() =>
            {
                ((MainWindowViewModel)DataContext).IsReady = true;
                ((MainWindowViewModel)DataContext).IsDone  = false;
                ObservableCollection <BuildItemViewModel> itemsCollection = new ObservableCollection <BuildItemViewModel>
                                                                                (buildItems.Select(x => new BuildItemViewModel(x, Dispatcher)));
                ((MainWindowViewModel)DataContext).Items = itemsCollection;
            });
        }
        public void SetUp()
        {
            var gitExe = new Mock <IExternalProcess>();

            _parser = new FakeParser();
            _logger = new FakeLogger();

            _fileSystem = new MockFileSystem(new Dictionary <string, MockFileData>());
            _directory  = new MockDirectoryInfo(_fileSystem, @"C:\databasename");

            _service = new GitScriptRepository(_directory, "servername", databaseName, gitExe.Object, _fileSystem, _parser, _logger, true);
        }