Esempio n. 1
0
        public void Sync_NonExistantLangDepotProject_ExitsGracefullyWithCorrectErrorResult()
        {
            _model = new SyncControlModel(_project, SyncUIFeatures.Minimal, null);
            _model.SyncOptions.RepositorySourcesToTry.Add(RepositoryAddress.Create("languageforge", "http://hg-public.languagedepot.org/dummy"));
            var progress = new ConsoleProgress()
            {
                ShowVerbose = true
            };

            _model.AddMessagesDisplay(progress);
            SyncResults results = null;

            _model.SynchronizeOver += new EventHandler((sender, e) => results = (sender as SyncResults));
            _model.Sync(true);
            var start = DateTime.Now;

            while (results == null)
            {
                Thread.Sleep(100);
                Application.DoEvents();            //else the background worker may starve
                if ((DateTime.Now.Subtract(start).Minutes > 1))
                {
                    Assert.Fail("Gave up waiting.");
                }
            }
            Assert.IsFalse(results.Succeeded);
            Assert.IsNotNull(results.ErrorEncountered);
        }
Esempio n. 2
0
 public void AfterSyncLogNotEmpty()
 {
     _model.Sync(false);
     var start = DateTime.Now;
     while(!_model.EnableSendReceive)
     {
         Thread.Sleep(100);
         Application.DoEvents();//without this, the background worker starves 'cause their's no UI
         if ((DateTime.Now.Subtract(start).Minutes > 0))
         {
             Assert.Fail("Gave up waiting.");
         }
     }
     Assert.IsNotEmpty(_progress.Text);
 }
Esempio n. 3
0
        public void Sync_Cancelled_ResultsHaveCancelledEqualsTrue()
        {
            _model = new SyncControlModel(_project, SyncUIFeatures.Minimal, null);
            _model.SyncOptions.RepositorySourcesToTry.Add(RepositoryAddress.Create("languageforge", "https://hg-public.languageforge.org/dummy"));
            var progress = new ConsoleProgress();

            _model.AddMessagesDisplay(progress);
            SyncResults results = null;

            _model.SynchronizeOver += (sender, e) => results = sender as SyncResults;
            _model.Sync(true);
            Thread.Sleep(100);
            _model.Cancel();
            // NOTE: we can't use AutoResetEvent with Sync() - for some reason this doesn't work
            WaitForSyncToFinish(ref results);

            Assert.That(results.Succeeded, Is.False);
            Assert.That(results.Cancelled, Is.True);
            Assert.That(results.ErrorEncountered, Is.Null);
        }
Esempio n. 4
0
        public void Sync_NonExistentLangForgeProject_ExitsGracefullyWithCorrectErrorResult()
        {
            _model = new SyncControlModel(_project, SyncUIFeatures.Minimal, null);
            _model.SyncOptions.RepositorySourcesToTry.Add(RepositoryAddress.Create("languageforge", "https://hg-public.languageforge.org/dummy"));
            var progress = new ConsoleProgress()
            {
                ShowVerbose = true
            };

            _model.AddMessagesDisplay(progress);
            SyncResults results = null;

            _model.SynchronizeOver += (sender, e) => results = sender as SyncResults;
            _model.Sync(true);
            // NOTE: we can't use AutoResetEvent with Sync() - for some reason this doesn't work
            WaitForSyncToFinish(ref results);

            Assert.That(results.Succeeded, Is.False);
            Assert.That(results.ErrorEncountered, Is.Not.Null);
        }