Ejemplo n.º 1
0
 public void TcpClientConnectsToTcpServer()
 {
     using (var tcpPair = new TcpConnectionPair())
     {
         tcpPair.AssertPairIsConnected();
     }
 }
Ejemplo n.º 2
0
 public void Origin_SayMissingCord_NotThrows()
 {
     using (var tcpPair = new TcpConnectionPair <IEmptyContract, ITestContract, TestContractMock>())
     {
         Assert.Multiple(() =>
         {
             TestTools.AssertNotBlocks(
                 () => tcpPair.OriginContract.OnSay());
             tcpPair.AssertPairIsConnected();
         });
     }
 }
Ejemplo n.º 3
0
 public void Proxy_AskMissingCord_Throws()
 {
     using (var tcpPair = new TcpConnectionPair <ITestContract, IEmptyContract, EmptyContract>())
     {
         Assert.Multiple(() =>
         {
             TestTools.AssertThrowsAndNotBlocks <RemoteContractImplementationException>(
                 () => tcpPair.ProxyConnection.Contract.Ask());
             tcpPair.AssertPairIsConnected();
         });
     }
 }
Ejemplo n.º 4
0
 public void Proxy_SayMissingCord_NotThrows()
 {
     using (var tcpPair = new TcpConnectionPair <ITestContract, IEmptyContract, EmptyContract>())
     {
         Assert.Multiple(() =>
         {
             TestTools.AssertNotBlocks(
                 () => tcpPair.ProxyConnection.Contract.Say());
             tcpPair.AssertPairIsConnected();
         });
     }
 }
Ejemplo n.º 5
0
 public void Origin_AsksNotImplemented_returnsDefault()
 {
     using (var tcpPair = new TcpConnectionPair <ITestContract, ITestContract, TestContractMock>())
     {
         Assert.Multiple(() =>
         {
             var answer = TestTools.AssertNotBlocks(tcpPair.OriginContract.OnAsk).Result;
             Assert.AreEqual(default(int), answer);
             tcpPair.AssertPairIsConnected();
         });
     }
 }
Ejemplo n.º 6
0
 public void Proxy_AskWithException_Throws()
 {
     using (var tcpPair = new TcpConnectionPair <IExceptionalContract, IExceptionalContract, ExceptionalContract>())
     {
         Assert.Multiple(() =>
         {
             TestTools.AssertThrowsAndNotBlocks <RemoteUnhandledException>(
                 () => tcpPair.ProxyConnection.Contract.Ask());
             tcpPair.AssertPairIsConnected();
         });
     }
 }
Ejemplo n.º 7
0
 public void Proxy_SayWithException_CallNotThrows()
 {
     using (var tcpPair = new TcpConnectionPair <IExceptionalContract, IExceptionalContract, ExceptionalContract>())
     {
         Assert.Multiple(() =>
         {
             TestTools.AssertNotBlocks(
                 () => tcpPair.ProxyConnection.Contract.Say());
             tcpPair.AssertPairIsConnected();
         });
     }
 }
Ejemplo n.º 8
0
 public void Origin_AskExceptioanlCallback_Throws()
 {
     using (var tcpPair = new TcpConnectionPair <ITestContract, ITestContract, TestContractMock>())
     {
         Assert.Multiple(() =>
         {
             tcpPair.ProxyContract.OnAsk += () => { throw new InvalidOperationException(); };
             TestTools.AssertThrowsAndNotBlocks <RemoteUnhandledException>(
                 () => tcpPair.OriginContract.OnAsk());
             tcpPair.AssertPairIsConnected();
         });
     }
 }
Ejemplo n.º 9
0
 public void Origin_SayExceptioanlCallback_NotThrows()
 {
     using (var tcpPair = new TcpConnectionPair <ITestContract, ITestContract, TestContractMock>())
     {
         tcpPair.ProxyContract.OnSay += () => { throw new InvalidOperationException(); };
         Assert.Multiple(() =>
         {
             TestTools.AssertNotBlocks(
                 () => tcpPair.OriginContract.OnSay());
             tcpPair.AssertPairIsConnected();
         });
     }
 }