本文整理汇总了C#中ServiceController.Panic方法的典型用法代码示例。如果您正苦于以下问题:C# ServiceController.Panic方法的具体用法?C# ServiceController.Panic怎么用?C# ServiceController.Panic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ServiceController
的用法示例。
在下文中一共展示了ServiceController.Panic方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestCorruptedServiceInPanicWillOverrideDisabledUpdates
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();
}
示例2: TestCorruptedServiceInPanicWillOverrideDisabledUpdatesAndRecover
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();
}
示例3: TestStoppedHealthyServiceInPanicWillRestart
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();
}
示例4: TestStoppedHealthyServiceInPanicWillNotUpdateWithUpdatesDisabled
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();
}