public void Send_WithNullRequestObject_ThrowsArgumentException() { // Arrange var cache = new SenderCache(requestRouter, monitorCache); // Act AsyncTestDelegate send = async() => await cache.Send <object, object>(null); // Act & Assert Assert.ThrowsAsync <ArgumentNullException>(send); }
public async Task Send_WithSenderReturnRequestObject_ReceivesSameObject() { // Arrange var cache = new SenderCache(requestRouter, monitorCache); var request = "Hello"; SetupMirroredResponse <string>(cache, request); // Act var response = await cache.Send <string, string>(request); // Assert Assert.That(response, Is.SameAs(request)); }
public async Task Send_WithRequest_SendsMessage() { // Arrange var cache = new SenderCache(requestRouter, monitorCache); var request = "Hello"; SetupMirroredResponse(cache, request); // Act var response = await cache.Send <string, string>(request); // Assert mockSender .Verify( m => m.SendAndReceive(It.IsIn(request), It.IsAny <TimeSpan>()), Times.Once); }