Beispiel #1
0
        public async Task Then_Gets_Addresses_From_Locations_Api(
            GetAddressesQuery query,
            GetAddressesListResponse apiResponse,
            [Frozen] Mock <ILocationApiClient <LocationApiConfiguration> > mockApiClient,
            GetAddressesQueryHandler handler)
        {
            mockApiClient
            .Setup(client => client.Get <GetAddressesListResponse>(It.IsAny <GetAddressesQueryRequest>()))
            .ReturnsAsync(apiResponse);

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

            result.AddressesResponse.Addresses.Should().BeEquivalentTo(apiResponse.Addresses);
        }
        public async Task Then_The_Service_Is_Called(
            string searchTerm,
            GetAddressesQuery query,
            List <SuggestedAddress> addresses,
            [Frozen] Mock <IAddressesService> service,
            GetAddressesQueryHandler handler)
        {
            //Arrange
            query.Query = searchTerm;
            service.Setup(x => x.FindFromDpaDataset(query.Query, query.MinMatch)).ReturnsAsync(addresses);
            //Act
            var actual = await handler.Handle(query, CancellationToken.None);

            //Assert
            actual.Addresses.Should().BeEquivalentTo(addresses);
        }