Esempio n. 1
0
        public void GivenAValidListofPropertyRefs_TheValidatorShouldReturnTrue(string propertyReference, string propertyReference2)
        {
            //arrange
            var propertiesUseCaseRequest = new GetMultiplePropertiesUseCaseRequest(new List <string> {
                propertyReference, propertyReference2
            });
            //act
            bool validationResult = _classUnderTest.Validate(propertiesUseCaseRequest).IsValid;

            //assert
            Assert.True(validationResult);
        }
Esempio n. 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));
        }