public void TestRestart3() { IGetInt32Property someGrain = null; _silo.OnHostStarted += () => { someGrain = _silo.CreateGrain <IGetInt32Property, ReturnsPid>(); _startHandle.Set(); }; _silo.Start(); var pid = _silo.HostProcessId.Value; someGrain.Value.Should().Be(pid); _startHandle.Reset(); var proc = Process.GetProcessById(pid); proc.Kill(); _startHandle.WaitOne(TimeSpan.FromSeconds(10)).Should().BeTrue("because the silo should've restarted the host process automatically"); var newPid = _silo.HostProcessId; someGrain.Value.Should().Be(newPid); }
public void TestRestart4() { IGetInt32Property someGrain = null; IVoidMethodNoParameters killer = null; _silo.OnHostStarted += () => { someGrain = _silo.CreateGrain <IGetInt32Property, ReturnsPid>(); killer = _silo.CreateGrain <IVoidMethodNoParameters, DeadlocksProcess>(); _startHandle.Set(); }; _silo.Start(); _startHandle.Reset(); new Action(() => killer.Do()).ShouldThrow <ConnectionLostException>(); _startHandle.WaitOne(TimeSpan.FromSeconds(10)).Should().BeTrue("because the silo should've restarted the host process automatically"); var newPid = _silo.HostProcessId; someGrain.Value.Should().Be(newPid); }