public void TestConfigWriteDispatchedEndDelegateCalled() { var end = false; var service = new ServiceController() { ServiceLoaderProxy = new MockServiceLoaderProxy(), WriteServiceConfigEnd = controller => end = true }; service.WriteServiceConfig(); Assert.IsTrue(end); service.Dispose(); }
public void TestConfigWriteDispatchedBeginDelegateCalled() { var begin = false; var service = new ServiceController() { ServiceLoaderProxy = new MockServiceLoaderProxy(), WriteServiceConfigBegin = controller => begin = true }; service.WriteServiceConfig(); Assert.IsTrue(begin); service.Dispose(); }
public void TestConfigWriteDispatchedSuccess() { var service = new ServiceController() { ServiceLoaderProxy = new MockServiceLoaderProxy() }; service.WriteServiceConfig(); Assert.IsTrue(((MockServiceLoaderProxy)service.ServiceLoaderProxy).OnWriteConfig); service.Dispose(); }
public void TestExceptionLoggedOnTimeout() { var service = new ServiceController() { ServiceLoaderProxy = new MockSlowServiceLoaderProxy() { WriteConfigSleep = 500 }, Settings = { WriteServiceConfigTimeout = 10 } }; service.WriteServiceConfig(); 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.WriteServiceConfig(); Assert.IsNotEmpty(Defines.ErrorsLogsDirectory.GetFiles()); Assert.Greater(Defines.ErrorsLogsDirectory.GetFiles().First().Length, 0); service.Dispose(); }