public void MapsRegularValues() { var response = (dynamic)target.MapToEditConfig(new ConfigInstance <SampleConfig>(sample, clientId), definition); Assert.Equal(sample.Choice, response.Choice); Assert.Equal(sample.IsLlamaFarmer, response.IsLlamaFarmer); Assert.Equal(sample.Decimal, response.Decimal); Assert.Equal(sample.LlamaCapacity, response.LlamaCapacity); Assert.Equal(sample.Name, response.Name); }
public object MapUploadToEditModel(string json, ConfigurationIdentity identity, ConfigurationModel model) { var uploadedInstance = uploadMapper.MapToConfigInstance(json, identity, model); if (uploadedInstance.GetConfiguration() == null) { uploadedInstance.SetConfiguration(uploadedInstance.ConstructNewConfiguration()); } return(configurationEditModelMapper.MapToEditConfig(uploadedInstance, model)); }
private Task HandleValueRequest(HttpContext context, ConfigInstance configInstance) { if (context.Request.Method == "GET") { return(responseFactory.BuildResponse(context, configurationEditModelMapper.MapToEditConfig(configInstance, GetConfigurationSetForModel(configInstance)))); } if (context.Request.Method == "POST") { return(HandleValuePostRequest(context, configInstance)); } throw new System.Exception("Only Get or Post methods expected"); }
private async Task HandleGetRequest(HttpContext context, ConfigurationClient client, string configType) { var configInstance = await configInstanceRouter.GetConfigInstanceOrDefault(client, configType); if (configInstance == null) { httpResponseFactory.BuildNotFoundStatusResponse(context); } else { await httpResponseFactory.BuildJsonResponse(context, configurationEditModelMapper.MapToEditConfig(configInstance, GetConfigurationModel(configInstance))); } }