public void GivenARequestContainingAListOfPropRefs_WhenIExecuteTheUseCase_ThenTheListOfPropRefsGetsPassedIntoTheGateway(string propertyReference, string propertyReference2)
        {
            //arrange
            var propertyReferences = new List <string> {
                propertyReference, propertyReference2
            };
            var request = new GetMultiplePropertiesUseCaseRequest(propertyReferences);

            //act
            _classUnderTest.Execute(request);
            //assert
            _mockGetMultiplePropertiesGateway.Verify(g => g.GetMultiplePropertiesByPropertyListOfReferences(It.Is <List <string> >(arg => arg[0] == propertyReferences[0] && arg[1] == propertyReferences[1])), Times.Once);
        }
예제 #2
0
        public IActionResult GetMultipleByReference([FromQuery] GetMultiplePropertiesUseCaseRequest propertyReferencesRequest)
        {
            _logger.LogInformation("Multiple Property information was requested for " + propertyReferencesRequest.PropertyReferences?.Select(s => s + " ").ToList());

            var validationResult = _getMultiplePropertiesValidator.Validate(propertyReferencesRequest);

            if (!validationResult.IsValid)
            {
                return(BadRequest(new GetMultiplePropertiesUseCaseResponse(validationResult)));
            }

            var useCaseResponse = _getMultiplePropertiesUseCase.Execute(propertyReferencesRequest);

            return(Ok(useCaseResponse));
        }