public async Task Then_data_is_fetched_via_data_repository()
        {
            //Arrange
            var query            = _fixture.Create <GetAccountsWithVrfCaseStatusRequest>();
            var accountsList     = _fixture.CreateMany <AccountDto>().ToList();
            var expectedResponse = new GetAccountsWithVrfCaseStatusResponse
            {
                Accounts = accountsList
            };

            _repository.Setup(x => x.GetByVrfCaseStatus(query.VrfStatus)).ReturnsAsync(accountsList);

            //Act
            var result = await _sut.Handle(query, CancellationToken.None);

            //Assert
            result.Should().BeEquivalentTo(expectedResponse);
        }
Example #2
0
        public async Task Then_data_is_returned_for_matching_accounts()
        {
            // Arrange
            var vrfStatus = LegalEntityVrfCaseStatus.RejectedVerification;
            var expected  = new GetAccountsWithVrfCaseStatusResponse {
                Accounts = _fixture.CreateMany <AccountDto>()
            };

            _queryDispatcherMock.Setup(x => x.Send <GetAccountsWithVrfCaseStatusRequest, GetAccountsWithVrfCaseStatusResponse>(
                                           It.Is <GetAccountsWithVrfCaseStatusRequest>(r => r.VrfStatus == vrfStatus)))
            .ReturnsAsync(expected);

            // Act
            var actual = await _sut.GetAccountsWithVrfCaseStatus(vrfStatus) as OkObjectResult;

            // Assert
            actual.Should().NotBeNull();
            actual.Value.Should().Be(expected.Accounts);
        }