public void GetMetadataEnumValue_Converts() { JObject metadata = new JObject { { "name", "TestFunc" }, { "direction", "inout" }, { "type", "queueTrigger" }, { "dataType", "string" }, { "string", "post" }, { "num", 0 } }; ScriptBindingContext context = new ScriptBindingContext(metadata); Assert.Equal(Test.post, context.GetMetadataEnumValue <Test>("string")); Assert.Equal(Test.get, context.GetMetadataEnumValue <Test>("num")); }
public void GetMetadataEnumValue_ThrowsHelpfulError() { JObject metadata = new JObject { { "name", "TestFunc" }, { "direction", "inout" }, { "type", "queueTrigger" }, { "dataType", "string" }, { "test", "not" }, }; ScriptBindingContext context = new ScriptBindingContext(metadata); FormatException e = Assert.Throws <FormatException>(() => context.GetMetadataEnumValue <Test>("test")); Assert.Equal("Error parsing function.json: Invalid value specified for binding property 'test' of enum type Test.", e.Message); }