public async Task Handler_Erro() { int number = -45; _mediator.Setup(m => m.Send(It.IsAny <GetDividersQuery>(), new CancellationToken())) .ReturnsAsync(new DividersResponse(number)); var command = new GetDividersQuery(number); var result = await _mediator.Object.Send(command); Assert.IsType <DividersResponse>(result); Assert.Empty(result.Dividers); }
public async Task Handler_Sucesso() { int number = 45; var expected = new List <int>() { 1, 3, 5, 9, 15, 45 }; _mediator.Setup(m => m.Send(It.IsAny <GetDividersQuery>(), new CancellationToken())) .ReturnsAsync(new DividersResponse(number)); var command = new GetDividersQuery(number); var result = await _mediator.Object.Send(command); Assert.IsType <DividersResponse>(result); Assert.Equal(expected, result.Dividers); }