public async Task Then_The_Query_Is_Handled_And_Data_Returned(
            GetAccountQuery query,
            GetAccountByIdResponse apiResponse,
            [Frozen] Mock <IAccountsApiClient <AccountsConfiguration> > accountsApiClient,
            GetAccountQueryHandler handler)
        {
            //Arrange
            var expectedGetUrl = new GetAccountByIdRequest(query.AccountId);

            accountsApiClient
            .Setup(x => x.Get <GetAccountByIdResponse>(
                       It.Is <GetAccountByIdRequest>(c => c.GetUrl.Equals(expectedGetUrl.GetUrl))))
            .ReturnsAsync(apiResponse);

            //Act
            var actual = await handler.Handle(query, CancellationToken.None);

            //Assert
            actual.Should().BeEquivalentTo(apiResponse);
        }
예제 #2
0
        public async Task <IActionResult> GetAccountById([FromRoute] Guid id)
        {
            GetAccountByIdResponse response = await mediator.Send(new GetAccountByIdRequest(id));

            return(Ok(response));
        }