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); }); }