Ejemplo n.º 1
0
 public InstallerContext Build(PackageManifest manifest, InstallInteractivityLevel interactivityLevel, PackageOperation operation)
 {
     return(new InstallerContext(manifest.Id, interactivityLevel, _windowsInstallerClient, _nexClient)
     {
         InstallerRecords = _windowsInstallerClient.GetRecords(),
         Operation = operation
     });
 }
Ejemplo n.º 2
0
        public void diff_should_show_removed()
        {
            var installerClient = new WindowsInstallerClient();

            var before = installerClient.GetRecords();
            var after  = installerClient.GetRecords();

            after.RemoveAt(20);

            var diffGenerator = new DiffGenerator <WindowsInstallerRecord>(before, after, c => $"{c.Is64}_{c.Id}");


            diffGenerator.Added().Should().BeEmpty();
            diffGenerator.Removed().Should().HaveCount(1);
            diffGenerator.Updated().Should().BeEmpty();
        }
Ejemplo n.º 3
0
        public void diff_should_show_updated()
        {
            var installerClient = new WindowsInstallerClient();

            var before = installerClient.GetRecords();
            var after  = installerClient.GetRecords();

            after[20].Values["foo"] = "bar";

            var diffGenerator = new DiffGenerator <WindowsInstallerRecord>(before, after, c => $"{c.Is64}_{c.Id}");


            diffGenerator.Added().Should().BeEmpty();
            diffGenerator.Removed().Should().BeEmpty();
            diffGenerator.Updated().Should().OnlyContain(c => c.Values["foo"].ToString() == "bar");
        }
Ejemplo n.º 4
0
        public async Task <List <PackageUpdate> > GetUpdates()
        {
            _logger.Debug("Getting list of installed application");
            var records = _windowsInstallerClient.GetRecords();

            _logger.Info("Getting list of matching packages...");
            var updates = await _novoClient.GetUpdates(records);

            return(updates);
        }
Ejemplo n.º 5
0
        public InstallerContext(string packageId, InstallInteractivityLevel interactivityLevel, WindowsInstallerClient installerClient, NexClient nexClient)
        {
            _packageId         = packageId;
            _installerClient   = installerClient;
            _nexClient         = nexClient;
            InteractivityLevel = interactivityLevel;


            _preOperationInstallRecords = installerClient.GetRecords();
            _stopWatch = Stopwatch.StartNew();
        }
Ejemplo n.º 6
0
        public void diff_should_return_empty_for_same_list()
        {
            var installerClient = new WindowsInstallerClient();

            var diffGenerator = new DiffGenerator <WindowsInstallerRecord>(installerClient.GetRecords(), installerClient.GetRecords(), c => $"{c.Is64}_{c.Id}");


            diffGenerator.Added().Should().BeEmpty();
            diffGenerator.Removed().Should().BeEmpty();
            diffGenerator.Updated().Should().BeEmpty();
        }
Ejemplo n.º 7
0
        public void diff_should_show_added()
        {
            var installerClient = new WindowsInstallerClient();

            var before = installerClient.GetRecords();
            var after  = installerClient.GetRecords();

            var newRecord = new WindowsInstallerRecord
            {
                Id = "new"
            };

            after.Add(newRecord);

            var diffGenerator = new DiffGenerator <WindowsInstallerRecord>(before, after, c => $"{c.Is64}_{c.Id}");


            diffGenerator.Added().Should().OnlyContain(c => c == newRecord);
            diffGenerator.Removed().Should().BeEmpty();
            diffGenerator.Updated().Should().BeEmpty();
        }
Ejemplo n.º 8
0
        private void SubmitResult()
        {
            var postOperationInstallRecords = _installerClient.GetRecords();
            var diff = new DiffGenerator <WindowsInstallerRecord>(_preOperationInstallRecords, postOperationInstallRecords, c => $"{c.Is64}_{c.Id}");

            var envInfo = new EnvInfo();

            var report = new InstallerReport
            {
                PackageId        = _packageId,
                InstallerRecords = new ChangeSet <WindowsInstallerRecord>
                {
                    Added   = diff.Added().ToList(),
                    Removed = diff.Removed().ToList(),
                    Updated = diff.Updated().ToList()
                },
                Interactivity = InteractivityLevel,
                Duration      = _stopWatch.Elapsed.TotalSeconds,
                Engine        = Whisperer?.InstallMethod.ToString(),
                IsAdmin       = envInfo.IsAdministrator,
                IsGui         = envInfo.IsGui
            };


            if (Process != null)
            {
                report.ExitCode = Process.ExitCode;
            }

            if (Exception != null)
            {
                report.ExitCode = Exception.ExitCode;
                report.ErrorCat = Exception.ExitReason?.Category.ToString();
            }

            _nexClient.SubmitReport(report).Wait();
        }
Ejemplo n.º 9
0
        public NovoClientFixture()
        {
            var installerClient = new WindowsInstallerClient();

            _installerRecords = installerClient.GetRecords();
        }