public async Task Then_Gets_UserAccounts_From_Mediator( string userId, GetAccountsQueryResult mediatorResult, [Frozen] Mock <IMediator> mockMediator, [Greedy] AccountUsersController controller) { mockMediator .Setup(mediator => mediator.Send( It.Is <GetAccountsQuery>(c => c.UserId.Equals(userId)), It.IsAny <CancellationToken>())) .ReturnsAsync(mediatorResult); var controllerResult = await controller.GetUserAccounts(userId) as ObjectResult; Assert.IsNotNull(controllerResult); controllerResult.StatusCode.Should().Be((int)HttpStatusCode.OK); var model = controllerResult.Value as UserAccountsApiResponse; Assert.IsNotNull(model); model.Should().BeEquivalentTo((UserAccountsApiResponse)mediatorResult); }
public void Then_The_Fields_Are_Correctly_Mapped(GetAccountsQueryResult source) { var actual = (UserAccountsApiResponse)source; actual.UserAccounts.Should().BeEquivalentTo(source.UserAccountResponse); }