public void TestExceptionLogged() { var service = new ServiceController() { ServiceDomain = AppDomain.CreateDomain("Potato.Instance"), UnloadServiceBegin = controller => { throw new Exception("Empty"); }, Process = new MockProcess() }; service.UnloadService(); Assert.IsNotEmpty(Defines.ErrorsLogsDirectory.GetFiles()); Assert.Greater(Defines.ErrorsLogsDirectory.GetFiles().First().Length, 0); service.Dispose(); }
public void TestExceptionKillsProcess() { var process = new MockProcess(); var service = new ServiceController() { ServiceDomain = AppDomain.CreateDomain("Potato.Instance"), UnloadServiceBegin = controller => { throw new Exception("Empty"); }, Process = process }; service.UnloadService(); Assert.IsTrue(process.OnKill); service.Dispose(); }
public void TestServiceDomainNulled() { var service = new ServiceController() { ServiceDomain = AppDomain.CreateDomain("Potato.Instance"), }; service.UnloadService(); Assert.IsNull(service.ServiceDomain); service.Dispose(); }
public void TestUnloadServiceDispatchedEndDelegateCalled() { var end = false; var service = new ServiceController() { ServiceDomain = AppDomain.CreateDomain("Potato.Instance"), UnloadServiceEnd = controller => end = true }; service.UnloadService(); Assert.IsTrue(end); service.Dispose(); }
public void TestUnloadServiceDispatchedBeginDelegateCalled() { var begin = false; var service = new ServiceController() { ServiceDomain = AppDomain.CreateDomain("Potato.Instance"), UnloadServiceBegin = controller => begin = true }; service.UnloadService(); Assert.IsTrue(begin); service.Dispose(); }