예제 #1
0
		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");
			}
		}
예제 #2
0
		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();
		}
예제 #3
0
        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();
        }
예제 #4
0
		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();
		}