public void GetMetadataValue_AttemptsConversion() { JObject metadata = new JObject { { "name", "TestFunc" }, { "direction", "inout" }, { "type", "queueTrigger" }, { "dataType", "string" }, { "take", "10" } }; ScriptBindingContext context = new ScriptBindingContext(metadata); Assert.Equal(10, context.GetMetadataValue <int?>("take")); }
public void GetMetadataValue_ThrowsHelpfulError() { JObject metadata = new JObject { { "name", "TestFunc" }, { "direction", "inout" }, { "type", "queueTrigger" }, { "dataType", "string" }, { "take", "asdf" } }; ScriptBindingContext context = new ScriptBindingContext(metadata); FormatException e = Assert.Throws <FormatException>(() => context.GetMetadataValue <int?>("take")); Assert.Equal("Error parsing function.json: Invalid value specified for binding property 'take' of type Nullable<Int32>.", e.Message); }