private IMapper SetupMapper(ConfigurationDataResponse expectedResponse) { var mockMapper = new Mock <IMapper>(); mockMapper.Setup(mapper => mapper.Map <ConfigurationDataResponse>(It.IsAny <ConfigurationDataEntity>())) .Returns(expectedResponse); return(mockMapper.Object); }
public void ReadConfiguration_Delegates_To_Service() { ConfigurationDataEntity expectedEntity = new ConfigurationDataEntity() { Something = "some data", ServiceEndpoints = new ConcurrentDictionary <string, ServiceEndpointDetail>() }; IConfigurationDataService service = SetupConfigurationDataService(expectedEntity); ConfigurationDataResponse expectedResponse = new ConfigurationDataResponse(); IMapper mapper = SetupMapper(expectedResponse); var controller = new ConfigurationDataController(service, mapper); var response = SuccessfulRead(controller); Assert.Same(expectedResponse, response); }