public void Should_run_installer_application_with_custom_name()
        {
            _autoUpdate.UpdateSettings.UpdatePath     = new Uri(_webServer.Uri, "update-file-custom-name-1.1.0.0.xml");
            _autoUpdate.UpdateSettings.CurrentVersion = new Version("1.0.0.0");
            _autoUpdate.InvalidSignatureDetected     += delegate
            {
                Assert.Fail("Invalid signature detected");
            };

            using (var socketListener = new SocketListener("Hello from: Custom\r\n"))
            {
                var acceptResult  = socketListener.Listen();
                var updatePending = _autoUpdate.IsUpdatePending();
                _autoUpdate.InstallPendingUpdate(_autoUpdate.PendingUpdates[0]);

                Assert.That(updatePending, Is.True);
                Assert.That(acceptResult.AsyncWaitHandle.WaitOne(TimeSpan.FromSeconds(10)), Is.True, "Timed out waiting for installer to call back");
            }
        }
        public void Should_not_run_installer_with_invalid_sig()
        {
            bool invalidSigDetected = false;

            _autoUpdate.UpdateSettings.UpdatePath     = new Uri(_webServer.Uri, "update-invalid-file-sig-1.1.0.0.xml");
            _autoUpdate.UpdateSettings.CurrentVersion = new Version("1.0.0.0");
            _autoUpdate.InvalidSignatureDetected     += delegate
            {
                invalidSigDetected = true;
            };


            using (var socketListener = new SocketListener(null))
            {
                var acceptResult  = socketListener.Listen();
                var updatePending = _autoUpdate.IsUpdatePending();
                _autoUpdate.InstallPendingUpdate(_autoUpdate.PendingUpdates[0]);

                Assert.That(updatePending, Is.True);
                Assert.That(acceptResult.AsyncWaitHandle.WaitOne(TimeSpan.FromSeconds(10)), Is.False, "Expected to time out waiting for installer to call back");
                Assert.That(invalidSigDetected, Is.True, "Expected invalid signature");
            }
        }
        public void Should_run_installer_application_with_custom_name()
        {
            _autoUpdate.UpdateSettings.UpdatePath = new Uri(_webServer.Uri, "update-file-custom-name-1.1.0.0.xml");
            _autoUpdate.UpdateSettings.CurrentVersion = new Version("1.0.0.0");
            _autoUpdate.InvalidSignatureDetected += delegate
            {
                Assert.Fail("Invalid signature detected");
            };

            using (var socketListener = new SocketListener("Hello from: Custom\r\n"))
            {
                var acceptResult = socketListener.Listen();
                var updatePending = _autoUpdate.IsUpdatePending();
                _autoUpdate.InstallPendingUpdate(_autoUpdate.PendingUpdates[0]);

                Assert.That(updatePending, Is.True);
                Assert.That(acceptResult.AsyncWaitHandle.WaitOne(TimeSpan.FromSeconds(10)), Is.True, "Timed out waiting for installer to call back");
            }
        }
        public void Should_not_run_installer_with_invalid_sig()
        {
            bool invalidSigDetected = false;
            _autoUpdate.UpdateSettings.UpdatePath = new Uri(_webServer.Uri, "update-invalid-file-sig-1.1.0.0.xml");
            _autoUpdate.UpdateSettings.CurrentVersion = new Version("1.0.0.0");
            _autoUpdate.InvalidSignatureDetected += delegate
            {
                invalidSigDetected = true;
            };

            using (var socketListener = new SocketListener(null))
            {
                var acceptResult = socketListener.Listen();
                var updatePending = _autoUpdate.IsUpdatePending();
                _autoUpdate.InstallPendingUpdate(_autoUpdate.PendingUpdates[0]);

                Assert.That(updatePending, Is.True);
                Assert.That(acceptResult.AsyncWaitHandle.WaitOne(TimeSpan.FromSeconds(10)), Is.False, "Expected to time out waiting for installer to call back");
                Assert.That(invalidSigDetected, Is.True, "Expected invalid signature");
            }
        }