public D8ErrorTicketManager1Facts()
 {
     _creds = UploaderConfigFile.Parse(UploaderCfg.Localhost);
     using (var scope = Repo2IoC.BeginScope())
     {
         _client = scope.Resolve <IR2RestClient>();
         _sut    = scope.Resolve <IErrorTicketManager>();
     }
 }
Exemple #2
0
 public R2ClientPatchPingFacts()
 {
     //_creds = UploaderConfigFile.Parse(UploaderCfg.KEY);
     _creds = DownloaderConfigFile.Parse(Downloader1Cfg.KEY);
     using (var scope = Repo2IoC.BeginScope())
     {
         _sut   = scope.Resolve <IR2RestClient>();
         _pings = scope.Resolve <IPingManager>();
     }
 }
Exemple #3
0
        public IssuePosterFacts()
        {
            var cfg = UploaderConfigFile.Parse(UploaderCfg.Localhost);

            using (var scope = Repo2IoC.BeginScope())
            {
                _fs     = scope.Resolve <IFileSystemAccesor>();
                _errors = scope.Resolve <IErrorTicketManager>();
                var cli = scope.Resolve <IR2RestClient>();
                cli.SetCredentials(cfg);
            }
        }
        public PackageUpdaterFacts()
        {
            IR2RestClient client;
            var           cfg = UploaderConfigFile.Parse(UploaderCfg.Localhost);

            using (var scope = Repo2IoC.BeginScope())
            {
                client   = scope.Resolve <IR2RestClient>();
                _downldr = scope.Resolve <ILocalPackageFileUpdater>();
            }
            client.SetCredentials(cfg);
        }
Exemple #5
0
        public ForceRevisionFacts()
        {
            using (var scope = Repo2IoC.BeginScope())
            {
                _client = scope.Resolve <IR2RestClient>();
                _pkgMgr = scope.Resolve <IRemotePackageManager>();
            }

            var cfg = UploaderConfigFile.Parse(UploaderCfg.Localhost);

            _client.SetCredentials(cfg);
        }
        public CachedPkgPartReader1Facts()
        {
            using (var scope = Repo2IoC.BeginScope())
            {
                _client = scope.Resolve <IR2RestClient>();
                _readr  = scope.Resolve <IPackagePartReader>();
                _cache  = _readr as CachedPkgPartReader1;
            }
            var cfg = UploaderConfigFile.Parse(UploaderCfg.Localhost);

            _client.SetCredentials(cfg);
        }
Exemple #7
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            var win = new MainWindow();

            try
            {
                using (var scope = Repo2IoC.BeginScope(this, "testDownloader1_open"))
                    win.DataContext = new MainWindowVM(scope, e.Args);

                win.Show();
            }
            catch (DependencyResolutionException ex)
            {
                Alerter.ShowError("Resolver Error", ex.GetMessage());
                win.Close();
            }
        }
Exemple #8
0
        private static async Task HandleError <T>(string caughtBy, T exceptionObj)
        {
            try
            {
                using (var scope = Repo2IoC.BeginScope())
                {
                    var tkt = R2ErrorTicket.From(exceptionObj);

                    if (!R2ConfigFile1.Found(_cfgKey))
                    {
                        Alerter.ShowError($"{caughtBy} Error", tkt.Description);
                        return;
                    }

                    var cfg = R2ConfigFile1.Parse(_cfgKey);
                    var cli = scope.Resolve <IR2RestClient>();
                    var svr = scope.Resolve <IErrorTicketManager>();

                    var ok = await cli.EnableWriteAccess(cfg, _addToWhiteList);

                    if (!ok)
                    {
                        throw new Exception("Failed to enable write access.");
                    }

                    svr.Post(tkt);

                    if (_showError)
                    {
                        Alerter.ShowError($"{caughtBy} Error", tkt.Title);
                    }
                }
            }
            catch (Exception ex)
            {
                Alerter.Show(ex, "Failed to Handle Error");
            }
        }