public void TestFailureDetection11() { var handler = new Mock <IFailureHandler>(); var settings = new FailureSettings { HeartbeatSettings = { ReportSkippedHeartbeatsAsFailureWithDebuggerAttached = true, Interval = TimeSpan.FromMilliseconds(100), SkippedHeartbeatThreshold = 4 } }; using (var silo = new SharpRemote.Hosting.OutOfProcessSilo(failureSettings: settings, failureHandler: handler.Object)) using (var handle = new ManualResetEvent(false)) { handler.Setup(x => x.OnResolutionFinished(It.IsAny <Failure>(), It.IsAny <Decision>(), It.IsAny <Resolution>())) .Callback((Failure f, Decision d, Resolution r) => { silo.Dispose(); handle.Set(); }); silo.Start(); int?id = silo.HostProcessId; id.Should().HaveValue(); Process hostProcess = Process.GetProcessById(id.Value); hostProcess.Kill(); handle.WaitOne(TimeSpan.FromSeconds(2)) .Should().BeTrue("Because the failure should've been detected as well as handled"); silo.IsDisposed.Should().BeTrue(); silo.HasProcessFailed.Should().BeTrue(); silo.IsProcessRunning.Should().BeFalse(); } }