Beispiel #1
0
        public void ProxySayCall_NoThreadDispatcher_OriginSayCalled(string sentMessage)
        {
            var channelPair     = TntTestHelper.CreateThreadlessChannelPair();
            var proxyConnection = TntBuilder
                                  .UseContract <ITestContract>()
                                  .UseReceiveDispatcher <NotThreadDispatcher>()
                                  .UseChannel(channelPair.CahnnelA)
                                  .Build();

            var originConnection = TntBuilder
                                   .UseContract <ITestContract, TestContractMock>()
                                   .UseReceiveDispatcher <NotThreadDispatcher>()
                                   .UseChannel(channelPair.ChannelB)
                                   .Build();

            channelPair.ConnectAndStartReceiving();

            proxyConnection.Contract.Say(sentMessage);
            var received = ((TestContractMock)originConnection.Contract).SaySCalled.Single();

            Assert.AreEqual(sentMessage, received);
        }
Beispiel #2
0
        private static void TestDirectTestConnection()
        {
            _output.WriteLine("-------------Direct test mock test--------------");

            var pair  = TntTestHelper.CreateThreadlessChannelPair();
            var proxy = TntBuilder
                        .UseContract <ISpeedTestContract>()
                        .UseReceiveDispatcher <ConveyorDispatcher>()
                        .UseChannel(pair.CahnnelA)
                        .Build();

            var origin = TntBuilder
                         .UseContract <ISpeedTestContract, SpeedTestContract>()
                         .UseReceiveDispatcher <ConveyorDispatcher>()
                         .UseChannel(pair.ChannelB)
                         .Build();

            pair.ConnectAndStartReceiving();

            Test(proxy);

            pair.Disconnect();
        }