public void TestCorruptedServiceInPanicWillOverrideDisabledUpdates() { var merged = false; var service = new ServiceController() { Packages = new MockServicePackageManager() { PackageInstalled = (sender, uri, packageId) => merged = true }, Settings = { ServiceUpdateCore = false }, ServiceLoaderProxyType = typeof(MockNonSerializableServiceLoaderProxy), Observer = { Status = ServiceStatusType.None } }; service.Panic(); Assert.IsTrue(merged); service.Dispose(); }
public void TestCorruptedServiceInPanicWillOverrideDisabledUpdatesAndRecover() { var merged = false; ServiceController service = null; service = new ServiceController() { Packages = new MockServicePackageManager() { PackageInstalled = (sender, uri, packageId) => { merged = true; // ReSharper disable AccessToModifiedClosure // We only do this to keep the test concise. if (service != null) { service.ServiceLoaderProxyType = typeof(MockServiceLoaderProxy); } // ReSharper restore AccessToModifiedClosure } }, Settings = { ServiceUpdateCore = false }, ServiceLoaderProxyType = typeof(MockNonSerializableServiceLoaderProxy), Observer = { Status = ServiceStatusType.None } }; service.Panic(); Assert.IsTrue(merged); Assert.AreEqual(ServiceStatusType.Started, service.Observer.Status); service.Dispose(); }
public void TestStoppedHealthyServiceInPanicWillRestart() { var service = new ServiceController() { Packages = new MockServicePackageManager(), Settings = { ServiceUpdateCore = true }, ServiceLoaderProxyType = typeof(MockServiceLoaderProxy) }; service.Panic(); Assert.AreEqual(ServiceStatusType.Started, service.Observer.Status); service.Dispose(); }
public void TestStoppedHealthyServiceInPanicWillNotUpdateWithUpdatesDisabled() { var merged = false; var service = new ServiceController() { Packages = new MockServicePackageManager() { PackageInstalled = (sender, uri, packageId) => merged = true }, Settings = { ServiceUpdateCore = false }, ServiceLoaderProxyType = typeof(MockServiceLoaderProxy), Observer = { Status = ServiceStatusType.None } }; service.Panic(); Assert.IsFalse(merged); service.Dispose(); }