public void TestStartStop2() { using (var silo = new SharpRemote.Hosting.OutOfProcessSilo()) { silo.Start(); silo.Stop(); Thread.Sleep(TimeSpan.FromSeconds(1)); silo.IsProcessRunning.Should().BeFalse(); silo.HostProcessId.Should().NotHaveValue(); } }
public void TestStop() { using (var silo = new SharpRemote.Hosting.OutOfProcessSilo()) { silo.IsProcessRunning.Should().BeFalse("because Start() hasn't been called yet"); silo.HostProcessId.Should().NotHaveValue("because Start() hasn't been called yet"); silo.IsConnected.Should().BeFalse("because Start() hasn't been called yet"); silo.Stop(); silo.IsProcessRunning.Should().BeFalse("because Start() hasn't been called yet"); silo.HostProcessId.Should().NotHaveValue("because Start() hasn't been called yet"); silo.IsConnected.Should().BeFalse("because Start() hasn't been called yet"); } }
public void TestStartStopStart1() { using (var silo = new SharpRemote.Hosting.OutOfProcessSilo()) { silo.Start(); silo.Stop(); silo.Start(); silo.IsProcessRunning.Should().BeTrue(); var pid = silo.HostProcessId; pid.Should().HaveValue(); ProcessShouldBeRunning(pid.Value); } }
public void TestStartStop4() { using (var collector = new LogCollector("SharpRemote", Level.Warn, Level.Error, Level.Fatal)) using (var silo = new SharpRemote.Hosting.OutOfProcessSilo()) { silo.Start(); silo.Stop(); Thread.Sleep(TimeSpan.FromSeconds(1)); collector.Events.Should().NotContain(x => x.RenderedMessage.Contains("exited unexpectedly")); collector.Events.Should().NotContain(x => x.Level >= Level.Warn); } }
public void TestStartStopDispose() { using (var logCollector = new LogCollector("SharpRemote", Level.Info, Level.Warn, Level.Error, Level.Fatal)) { var silo = new SharpRemote.Hosting.OutOfProcessSilo(); silo.Start(); silo.Stop(); new Action(silo.Dispose) .ShouldNotThrow(); logCollector.Log.Should().NotContain("Caught exception while disposing"); logCollector.Log.Should().NotContain("SharpRemote.NotConnectedException"); } }
public void TestStartStop1() { using (var silo = new SharpRemote.Hosting.OutOfProcessSilo()) { silo.Start(); silo.IsProcessRunning.Should().BeTrue("because Start() has been called and the host should be running now"); silo.IsConnected.Should().BeTrue("because Start() has been called and the connection to the host should be running"); var pid = silo.HostProcessId; pid.Should().HaveValue(); ProcessShouldBeRunning(pid.Value); silo.Stop(); silo.IsProcessRunning.Should().BeFalse(); silo.HostProcessId.Should().NotHaveValue(); ProcessShouldNotBeRunning(pid.Value); } }
public void TestStartStop3() { var failureHandler = new FailureHandlerMock(); using (var silo = new SharpRemote.Hosting.OutOfProcessSilo(failureHandler: failureHandler)) { silo.Start(); silo.Stop(); Thread.Sleep(TimeSpan.FromSeconds(1)); const string reason = "because no failure should've occured (due to the intentional shutdown) and therefore the callback may not have been invoked"; failureHandler.NumStartFailure.Should().Be(0, reason); failureHandler.NumFailure.Should().Be(0, reason); failureHandler.NumResolutionFailed.Should().Be(0, reason); failureHandler.NumResolutionFinished.Should().Be(0, reason); } }
public void TestStartStopStart2() { using (var silo = new SharpRemote.Hosting.OutOfProcessSilo()) { silo.Start(); var proxy = silo.CreateGrain <IReturnsType>(typeof(ReturnsTypeofString)); proxy.Do().Should().Be <string>(); silo.Stop(); new Action(() => proxy.Do()) .ShouldThrow <RemoteProcedureCallCanceledException>(); new Action(() => silo.CreateGrain <IReturnsType>(typeof(ReturnsTypeofString))) .ShouldThrow <RemoteProcedureCallCanceledException>(); silo.Start(); var newProxy = silo.CreateGrain <IReturnsType>(typeof(ReturnsTypeofString)); newProxy.Do().Should().Be <string>(); } }