public void TestDisposeServiceDispatchedEndDelegateCalled() { var end = false; var service = new ServiceController() { ServiceLoaderProxy = new MockServiceLoaderProxy(), DisposeServiceEnd = controller => end = true }; service.DisposeService(); Assert.IsTrue(end); service.Dispose(); }
public void TestDisposeServiceDispatchedBeginDelegateCalled() { var begin = false; var service = new ServiceController() { ServiceLoaderProxy = new MockServiceLoaderProxy(), DisposeServiceBegin = controller => begin = true }; service.DisposeService(); Assert.IsTrue(begin); service.Dispose(); }
public void TestDisposeServiceDispatchedSuccess() { var disposed = false; var service = new ServiceController() { ServiceLoaderProxy = new MockServiceLoaderProxy() { OnDisposeHandler = () => disposed = true } }; service.DisposeService(); Assert.IsTrue(disposed); service.Dispose(); }
public void TestServiceLoaderProxyNulled() { var service = new ServiceController() { ServiceLoaderProxy = new MockServiceLoaderProxy() }; service.DisposeService(); Assert.IsNull(service.ServiceLoaderProxy); service.Dispose(); }
public void TestExceptionLoggedOnTimeout() { var service = new ServiceController() { ServiceLoaderProxy = new MockSlowServiceLoaderProxy() { DisposeSleep = 500 }, Settings = { DisposeServiceTimeout = 10 } }; service.DisposeService(); Assert.IsNotEmpty(Defines.ErrorsLogsDirectory.GetFiles()); Assert.Greater(Defines.ErrorsLogsDirectory.GetFiles().First().Length, 0); service.Dispose(); }
public void TestExceptionLogged() { var service = new ServiceController() { ServiceLoaderProxy = new MockNonSerializableServiceLoaderProxy() }; service.DisposeService(); Assert.IsNotEmpty(Defines.ErrorsLogsDirectory.GetFiles()); Assert.Greater(Defines.ErrorsLogsDirectory.GetFiles().First().Length, 0); service.Dispose(); }