Example #1
0
        public void TestValidateAddressStringInvalidAddress()
        {
            const string address = "Invalid address";
            var          ex      = new InvalidAddressException();

            _addressGeocodingService.Setup(mocked => mocked.ValidateAddress(address)).Throws(ex);

            var result = _fixture.ValidateAddress(address);

            Assert.IsNotNull(result);
            Assert.IsInstanceOf <ResponseMessageResult>(result);
            var responseMessageResult = (ResponseMessageResult)result;

            Assert.AreEqual(HttpStatusCode.NotFound, responseMessageResult.Response.StatusCode);
        }
Example #2
0
        public void TestValidateAddressObjectInvalidAddress()
        {
            var address = new AddressDTO
            {
                AddressLine1 = "Invalid address",
                PostalCode   = "12345"
            };
            var ex = new InvalidAddressException();

            _addressGeocodingService.Setup(mocked => mocked.ValidateAddress(address.ToString())).Throws(ex);

            var result = _fixture.ValidateAddress(address);

            Assert.IsNotNull(result);
            Assert.IsInstanceOf <ResponseMessageResult>(result);
            var responseMessageResult = (ResponseMessageResult)result;

            Assert.AreEqual(HttpStatusCode.NotFound, responseMessageResult.Response.StatusCode);
        }