Example #1
0
        public async Task Then_The_Api_Is_Called_With_The_Request_And_The_AccountUsers_Are_Returned(
            GetAccountUsersQuery query,
            GetAccountUsersResponse apiResponse,
            [Frozen] Mock <IAccountsApiClient <AccountsConfiguration> > apiClient,
            GetAccountUsersQueryHandler handler
            )
        {
            apiClient.Setup(x => x.Get <GetAccountUsersResponse>(It.Is <GetAccountUsersRequest>(x => x.HashedAccountId == query.HashedAccountId))).ReturnsAsync(apiResponse);

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

            actual.Should().BeEquivalentTo(apiResponse);
        }
        public async Task Then_Returns_Users_From_Service(
            GetAccountUsersQuery query,
            long accountId,
            List <EmployerAccountUser> users,
            [Frozen] Mock <IEmployerAccountService> mockEmployerAccountService,
            GetAccountUsersQueryHandler handler)
        {
            mockEmployerAccountService
            .Setup(service => service.GetAccountUsers(query.AccountId))
            .ReturnsAsync(users);

            var result = await handler.Handle(query, CancellationToken.None);

            result.AccountUsers.Should().BeEquivalentTo(users);
        }