public void Context()
 {
     _scenario = new CoreBusScenarioBuilder<WebSocketCoreBusServer, WebSocketCoreBusClient>(
         serverListenPort => new WebSocketCoreBusServer(serverListenPort),
         (uri, serverListenPort) => new WebSocketCoreBusClient(uri)
         )
         .Build();
     _client = _scenario.GetClient();
 }
 public void Context()
 {
     _scenario = new CoreBusScenarioBuilder<WebSocketCoreBusServer, WebSocketCoreBusClient>(
         serverListenPort => new WebSocketCoreBusServer(serverListenPort),
         (uri, serverListenPort) => new WebSocketCoreBusClient(uri)
         )
         .WithNumberOfClients(2)
         .Build();
     _clientOne = _scenario.GetClient(0);
     _clientTwo = _scenario.GetClient(1);
 }
 private Task SendMultipleMessagesFromClientInNewTask(ICoreBusClient client, int numberOfMessagesToBeSent, int expectedTotalNumberOfMessagesReceivedByServer)
 {
     return Task.Factory.StartNew(() =>
     {
         for (var i = 0; i < numberOfMessagesToBeSent; i++)
         {
             client.Send("Test message");
         }
         _scenario.WaitUntilServerReceivedMessagesFromClient(index: 0, numberOfMessages: expectedTotalNumberOfMessagesReceivedByServer);
         _scenario.ReceivedMessagesFromClient().Count.ShouldBe(expectedTotalNumberOfMessagesReceivedByServer);
     });
 }
 private Task SendMultipleMessagesFromClientInNewTask(ICoreBusClient client, int clientIndex)
 {
     return Task.Factory.StartNew(() =>
     {
         const int numberOfMessages = 10;
         for (var i = 0; i < numberOfMessages; i++)
         {
             client.Send("Test message");
         }
         _scenario.WaitUntilServerReceivedMessagesFromClient(index: clientIndex, numberOfMessages: numberOfMessages);
         _scenario.ReceivedMessagesFromClient(clientIndex).Count.ShouldBe(numberOfMessages);
     });
 }
Example #5
0
 public void Act(ICoreBusClient client)
 {
     client.Dispose();
 }
Example #6
0
 public void Act(ICoreBusClient client)
 {
     client.Close();
 }