public static void AddParameterModels(string parameterName, FunctionInstanceArgument argument, ParameterLog log, FunctionInstanceSnapshot snapshot, ICollection <ParamModel> parameterModels) { ParamModel model = new ParamModel { Name = parameterName, ArgInvokeString = argument.Value }; if (log != null) { model.Status = Format(log); } if (argument.IsBlob) { model.ExtendedBlobModel = LogAnalysis.CreateExtendedBlobModel(snapshot, argument); } parameterModels.Add(model); // Special-case IBinder, which adds sub-parameters. BinderParameterLog binderLog = log as BinderParameterLog; if (binderLog != null) { IEnumerable <BinderParameterLogItem> items = binderLog.Items; if (items != null) { int count = items.Count(); model.Status = String.Format(CultureInfo.CurrentCulture, "Bound {0} object{1}.", count, count != 1 ? "s" : String.Empty); foreach (BinderParameterLogItem item in items) { if (item == null) { continue; } ParameterSnapshot itemSnapshot = HostIndexer.CreateParameterSnapshot(item.Descriptor); string itemName = parameterName + ": " + itemSnapshot.AttributeText; FunctionInstanceArgument itemArgument = FunctionIndexer.CreateFunctionInstanceArgument(item.Value, item.Descriptor); AddParameterModels(itemName, itemArgument, item.Log, snapshot, parameterModels); } } } }
public void CreateParameterSnapshot_DisplayHintsSet_ReturnsDisplayHintsParameterSnapshot() { ParameterDescriptor descriptor = new ParameterDescriptor(); descriptor.DisplayHints = new ParameterDisplayHints { Description = "My custom description", Prompt = "Enter your value please", DefaultValue = "1234" }; ParameterSnapshot shapshot = HostIndexer.CreateParameterSnapshot(descriptor); Assert.Equal(descriptor.DisplayHints.Description, shapshot.Description); Assert.Equal(descriptor.DisplayHints.Prompt, shapshot.Prompt); Assert.Equal(descriptor.DisplayHints.DefaultValue, shapshot.DefaultValue); }