public async void SendsAndReceivesNullSuccessfully( [ValueSource("OutsourcedWorkerConnections")] IWorkerConnection connection) { // Arrange var ct = new CancellationToken(); TestStream.Position = 0; // To start from fresh // Act await connection.SendObjectAsync(null, ct).ConfigureAwait(false); TestStream.Position = 0; // To read what we just wrote var deserialized = await connection.ReceiveObjectAsync(ct).ConfigureAwait(false); // Assert Assert.That(deserialized, Is.EqualTo(null)); }
public async void SendsAndReceivesObjectSuccessfully <T>( [ValueSource("OutsourcedWorkerConnections")] IWorkerConnection connection, [ValueSource("TestObjects")] T testValue) { // Arrange var ct = new CancellationToken(); TestStream.Position = 0; // To start from fresh // Act await connection.SendObjectAsync(testValue, ct).ConfigureAwait(false); TestStream.Position = 0; // To read what we just wrote var deserialized = (T)await connection.ReceiveObjectAsync(ct).ConfigureAwait(false); // Assert deserialized.ShouldBeEquivalentTo(testValue); }