public void HandleServerException() { RemotingMock cc = new RemotingMock(typeof(ICruiseManager)); cc.ExpectAndThrow("Run", new Exception("server exception"), new IsAnything(), new IsAnything()); TcpChannel channel = new TcpChannel(2334); using (MockServer server = new MockServer(cc.MarshalByRefInstance, channel, "MockCruise.rem")) { Runner runner = new Runner(); runner.Url = "tcp://localhost:2334/MockCruise.rem"; runner.Run("myProject"); } }
public void MarshalRemotingMock() { RemotingMock mock = new RemotingMock(typeof(Foo)); mock.Expect("Bar"); TcpChannel channel = new TcpChannel(1234); using (MockServer server = new MockServer(mock.MarshalByRefInstance, channel, "mock.rem")) { Foo foo = (Foo)RemotingServices.Connect(typeof(Foo), "tcp://localhost:1234/mock.rem"); foo.Bar(); } mock.Verify(); }
public void SendScheduleToCruiseManager() { CollectingConstraint projectNameConstraint = new CollectingConstraint(); CollectingConstraint scheduleConstraint = new CollectingConstraint(); RemotingMock cc = new RemotingMock(typeof(ICruiseManager)); cc.Expect("Run", projectNameConstraint, scheduleConstraint); using (MockServer server = new MockServer(cc.MarshalByRefInstance, new TcpChannel(2334), "MockCruise.rem")) { Runner runner = new Runner(); runner.Url = "tcp://localhost:2334/MockCruise.rem"; runner.Run("myProject"); } AssertEquals("myProject", projectNameConstraint.Parameter); AssertEquals(new Schedule(), scheduleConstraint.Parameter); cc.Verify(); }