Example #1
0
        public void GivenValidSearchAddressRequest_WhenCallingGet_ThenShouldReturnAPIResponseListOfAddresses(string postcode, GlobalConstants.Gazetteer gazetteer)
        {
            //arrange
            _mock.Setup(s => s.ExecuteAsync(It.IsAny <SearchAddressRequest>()))
            .Returns(new SearchAddressResponse
            {
                Addresses = new List <AddressResponse>()
            });

            var request = new SearchAddressRequest
            {
                PostCode  = postcode,
                Gazetteer = gazetteer.ToString()
            };
            //act
            var response = _classUnderTest.GetAddresses(request);

            //assert
            response.Should().NotBeNull();
            response.Should().BeOfType <OkObjectResult>();
            var objectResult = response as OkObjectResult;
            var getAddresses = objectResult?.Value as APIResponse <SearchAddressResponse>;

            getAddresses.Should().NotBeNull();
        }
Example #2
0
        public async Task GivenValidSearchAddressRequest_WhenCallingGet_ThenShouldReturnAPIResponseListOfAddresses(string postcode, GlobalConstants.AddressScope addressScope)
        {
            //arrange
            _mock.Setup(s => s.ExecuteAsync(It.IsAny <SearchAddressRequest>()))
            .ReturnsAsync(new SearchAddressResponse
            {
                Addresses = new List <AddressResponse>()
            });

            var request = new SearchAddressRequest
            {
                Postcode     = postcode,
                AddressScope = addressScope.ToString()
            };
            //act
            var response = await _classUnderTest.GetAddresses(request).ConfigureAwait(true);

            //assert
            response.Should().NotBeNull();
            response.Should().BeOfType <OkObjectResult>();
            var objectResult = response as OkObjectResult;
            var getAddresses = objectResult?.Value as APIResponse <SearchAddressResponse>;

            getAddresses.Should().NotBeNull();
        }