@@ -80,6 +80,45 @@ public void ValidateFunction_NoTriggerBinding_Throws()
80
80
Assert . Equal ( "No trigger binding specified. A function must have a trigger input binding." , ex . Message ) ;
81
81
}
82
82
83
+ [ Fact ]
84
+ public void VerifyResolvedBindings_WithNoBindingMatch_ThrowsExpectedException ( )
85
+ {
86
+ FunctionMetadata functionMetadata = new FunctionMetadata ( ) ;
87
+ BindingMetadata triggerMetadata = BindingMetadata . Create ( JObject . Parse ( "{\" type\" : \" blobTrigger\" ,\" name\" : \" req\" ,\" direction\" : \" in\" }" ) ) ;
88
+ BindingMetadata bindingMetadata = BindingMetadata . Create ( JObject . Parse ( "{\" type\" : \" unknownbinding\" ,\" name\" : \" blob\" ,\" direction\" : \" in\" }" ) ) ;
89
+
90
+ functionMetadata . Bindings . Add ( triggerMetadata ) ;
91
+ functionMetadata . Bindings . Add ( bindingMetadata ) ;
92
+
93
+ var ex = Assert . Throws < ScriptConfigurationException > ( ( ) =>
94
+ {
95
+ _provider . TryCreate ( functionMetadata , out FunctionDescriptor descriptor ) ;
96
+ } ) ;
97
+
98
+ Assert . Contains ( "unknownbinding" , ex . Message ) ;
99
+ }
100
+
101
+ [ Fact ]
102
+ public void VerifyResolvedBindings_WithValidBindingMatch_DoesNotThrow ( )
103
+ {
104
+ FunctionMetadata functionMetadata = new FunctionMetadata ( ) ;
105
+ BindingMetadata triggerMetadata = BindingMetadata . Create ( JObject . Parse ( "{\" type\" : \" httpTrigger\" ,\" name\" : \" req\" ,\" direction\" : \" in\" }" ) ) ;
106
+ BindingMetadata bindingMetadata = BindingMetadata . Create ( JObject . Parse ( "{\" type\" : \" http\" ,\" name\" : \" $return\" ,\" direction\" : \" out\" }" ) ) ;
107
+
108
+ functionMetadata . Bindings . Add ( triggerMetadata ) ;
109
+ functionMetadata . Bindings . Add ( bindingMetadata ) ;
110
+ try
111
+ {
112
+ _provider . TryCreate ( functionMetadata , out FunctionDescriptor descriptor ) ;
113
+ Assert . True ( true , "No exception thrown" ) ;
114
+ }
115
+ catch ( Exception ex )
116
+ {
117
+ Assert . True ( false , "Exception not expected:" + ex . Message ) ;
118
+ throw ;
119
+ }
120
+ }
121
+
83
122
[ Fact ]
84
123
public void CreateTriggerParameter_WithNoBindingMatch_ThrowsExpectedException ( )
85
124
{
0 commit comments