@@ -28,6 +28,7 @@ public class JobhostEndToEnd
2828
2929 [ Theory ]
3030 [ TestCase ( "EventGridParams.TestEventGridToString_Single" ) ]
31+ [ TestCase ( "EventGridParams.TestEventGridToBinaryData_Single" ) ]
3132 [ TestCase ( "EventGridParams.TestEventGridToJObject_Single" ) ]
3233 [ TestCase ( "EventGridParams.TestEventGridToNuget_Single" ) ]
3334 [ TestCase ( "EventGridParams.TestEventGridToValidCustom_Single" ) ]
@@ -52,6 +53,7 @@ public async Task ConsumeEventGridEventTest_Single(string functionName)
5253
5354 [ Theory ]
5455 [ TestCase ( "CloudEventParams.TestEventGridToString_Single" ) ]
56+ [ TestCase ( "CloudEventParams.TestEventGridToBinaryData_Single" ) ]
5557 [ TestCase ( "CloudEventParams.TestEventGridToJObject_Single" ) ]
5658 [ TestCase ( "CloudEventParams.TestEventGridToNuget_Single" ) ]
5759 [ TestCase ( "CloudEventParams.TestEventGridToValidCustom_Single" ) ]
@@ -74,6 +76,7 @@ public async Task ConsumeCloudEventTest_Single(string functionName)
7476 [ Theory ]
7577 [ TestCase ( "EventGridParams.TestEventGridToCollection_Batch" ) ]
7678 [ TestCase ( "EventGridParams.TestEventGridToStringCollection_Batch" ) ]
79+ [ TestCase ( "EventGridParams.TestEventGridToBinaryDataCollection_Batch" ) ]
7780 [ TestCase ( "EventGridParams.TestEventGridToJObjectCollection_Batch" ) ]
7881 [ TestCase ( "EventGridParams.TestEventGridToCustomCollection_Batch" ) ]
7982 public async Task ConsumeEventGridEventTests_Batch ( string functionName )
@@ -96,6 +99,7 @@ public async Task ConsumeEventGridEventTests_Batch(string functionName)
9699 [ Theory ]
97100 [ TestCase ( "CloudEventParams.TestEventGridToCollection_Batch" ) ]
98101 [ TestCase ( "CloudEventParams.TestEventGridToStringCollection_Batch" ) ]
102+ [ TestCase ( "CloudEventParams.TestEventGridToBinaryDataCollection_Batch" ) ]
99103 [ TestCase ( "CloudEventParams.TestEventGridToJObjectCollection_Batch" ) ]
100104 [ TestCase ( "CloudEventParams.TestEventGridToCustomCollection_Batch" ) ]
101105 public async Task ConsumeCloudEventTests_Batch ( string functionName )
@@ -223,13 +227,15 @@ public void OutputBindingInvalidCredentialTests()
223227 [ Theory ]
224228 [ TestCase ( "SingleEvent" , "0" ) ]
225229 [ TestCase ( "SingleEventString" , "0" ) ]
230+ [ TestCase ( "SingleEventBinaryData" , "0" ) ]
226231 [ TestCase ( "SingleEventJObject" , "0" ) ]
227232 [ TestCase ( "SingleReturnEvent" , "0" ) ]
228233 // space separated string as event ids
229234 [ TestCase ( "ArrayEvent" , "0 1 2 3 4" ) ]
230235 [ TestCase ( "CollectorEvent" , "0 1 2 3" ) ]
231236 [ TestCase ( "AsyncCollectorEvent" , "0 1 2 3 4 5 6" ) ]
232237 [ TestCase ( "StringEvents" , "0 1 2 3 4" ) ]
238+ [ TestCase ( "BinaryDataEvents" , "0 1 2 3 4" ) ]
233239 [ TestCase ( "JObjectEvents" , "0 1 2 3 4" ) ]
234240 public async Task OutputBindingParamsTests ( string functionName , string expectedCollection )
235241 {
@@ -283,11 +289,21 @@ public void TestEventGridToString_Single([EventGridTrigger] string value)
283289 _functionOut = ( string ) JObject . Parse ( value ) [ "subject" ] ;
284290 }
285291
292+ public void TestEventGridToBinaryData_Single ( [ EventGridTrigger ] BinaryData value )
293+ {
294+ _functionOut = ( string ) JObject . Parse ( value . ToString ( ) ) [ "subject" ] ;
295+ }
296+
286297 public void TestEventGridToStringCollection_Batch ( [ EventGridTrigger ] string [ ] values )
287298 {
288299 _functionOut = string . Join ( ", " , values . Select ( v => ( string ) JObject . Parse ( v ) [ "subject" ] ) ) ;
289300 }
290301
302+ public void TestEventGridToBinaryDataCollection_Batch ( [ EventGridTrigger ] BinaryData [ ] values )
303+ {
304+ _functionOut = string . Join ( ", " , values . Select ( v => ( string ) JObject . Parse ( v . ToString ( ) ) [ "subject" ] ) ) ;
305+ }
306+
291307 public void TestEventGridToJObject_Single ( [ EventGridTrigger ] JObject value )
292308 {
293309 _functionOut = ( string ) value [ "subject" ] ;
@@ -328,13 +344,15 @@ public void TestEventGridToCustomCollection_Batch([EventGridTrigger] ValidPoco[]
328344 [ Theory ]
329345 [ TestCase ( "SingleEvent" , "0" ) ]
330346 [ TestCase ( "SingleEventString" , "0" ) ]
347+ [ TestCase ( "SingleEventBinaryData" , "0" ) ]
331348 [ TestCase ( "SingleEventJObject" , "0" ) ]
332349 [ TestCase ( "SingleReturnEvent" , "0" ) ]
333350 // space separated string as event ids
334351 [ TestCase ( "ArrayEvent" , "0 1 2 3 4" ) ]
335352 [ TestCase ( "CollectorEvent" , "0 1 2 3" ) ]
336353 [ TestCase ( "AsyncCollectorEvent" , "0 1 2 3 4 5 6" ) ]
337354 [ TestCase ( "StringEvents" , "0 1 2 3 4" ) ]
355+ [ TestCase ( "BinaryDataEvents" , "0 1 2 3 4" ) ]
338356 [ TestCase ( "JObjectEvents" , "0 1 2 3 4" ) ]
339357 public async Task OutputCloudEventBindingParamsTests ( string functionName , string expectedCollection )
340358 {
@@ -419,11 +437,21 @@ public void TestEventGridToString_Single([EventGridTrigger] string value)
419437 _functionOut = ( string ) JObject . Parse ( value ) [ "subject" ] ;
420438 }
421439
440+ public void TestEventGridToBinaryData_Single ( [ EventGridTrigger ] BinaryData value )
441+ {
442+ _functionOut = ( string ) JObject . Parse ( value . ToString ( ) ) [ "subject" ] ;
443+ }
444+
422445 public void TestEventGridToStringCollection_Batch ( [ EventGridTrigger ] string [ ] values )
423446 {
424447 _functionOut = string . Join ( ", " , values . Select ( v => ( string ) JObject . Parse ( v ) [ "subject" ] ) ) ;
425448 }
426449
450+ public void TestEventGridToBinaryDataCollection_Batch ( [ EventGridTrigger ] BinaryData [ ] values )
451+ {
452+ _functionOut = string . Join ( ", " , values . Select ( v => ( string ) JObject . Parse ( v . ToString ( ) ) [ "subject" ] ) ) ;
453+ }
454+
427455 public void TestEventGridToJObject_Single ( [ EventGridTrigger ] JObject value )
428456 {
429457 _functionOut = ( string ) value [ "subject" ] ;
@@ -500,9 +528,9 @@ public void TestString(
500528
501529 public void TestDataFieldMissing (
502530 [ EventGridTrigger ] JObject value ,
503- [ BindingData ( "{data}" ) ] string autoResovle )
531+ [ BindingData ( "{data}" ) ] string autoResolve )
504532 {
505- _functionOut = autoResovle ;
533+ _functionOut = autoResolve ;
506534 }
507535
508536 // auto resolve only works for string
@@ -566,6 +594,18 @@ public void SingleEventString([EventGrid(TopicEndpointUri = "eventgridUri", Topi
566594 }" ;
567595 }
568596
597+ public void SingleEventBinaryData ( [ EventGrid ( TopicEndpointUri = "eventgridUri" , TopicKeySetting = "eventgridKey" ) ] out BinaryData single )
598+ {
599+ single = new BinaryData ( @"
600+ {
601+ ""id"" : ""id"",
602+ ""data"" : ""0"",
603+ ""eventType"" : ""custom"",
604+ ""subject"" : ""custom"",
605+ ""dataVersion"" : ""1""
606+ }" ) ;
607+ }
608+
569609 public void SingleEventJObject ( [ EventGrid ( TopicEndpointUri = "eventgridUri" , TopicKeySetting = "eventgridKey" ) ] out JObject single )
570610 {
571611 single = new JObject (
@@ -625,7 +665,6 @@ public async Task AsyncCollectorEvent([EventGrid(TopicEndpointUri = "eventgridUr
625665 }
626666 }
627667
628- // assume converter is applied correctly with other output binding types
629668 public void StringEvents ( [ EventGrid ( TopicEndpointUri = "eventgridUri" , TopicKeySetting = "eventgridKey" ) ] out string [ ] strings )
630669 {
631670 strings = new string [ 5 ] ;
@@ -642,7 +681,22 @@ public void StringEvents([EventGrid(TopicEndpointUri = "eventgridUri", TopicKeyS
642681 }
643682 }
644683
645- // assume converter is applied correctly with other output binding types
684+ public void BinaryDataEvents ( [ EventGrid ( TopicEndpointUri = "eventgridUri" , TopicKeySetting = "eventgridKey" ) ] out BinaryData [ ] data )
685+ {
686+ data = new BinaryData [ 5 ] ;
687+ for ( int i = 0 ; i < 5 ; i ++ )
688+ {
689+ data [ i ] = new BinaryData ( $@ "
690+ {{
691+ ""id"" : ""{ i } "",
692+ ""data"" : ""{ i } "",
693+ ""eventType"" : ""custom"",
694+ ""subject"" : ""custom"",
695+ ""dataVersion"" : ""1""
696+ }}" ) ;
697+ }
698+ }
699+
646700 public void JObjectEvents ( [ EventGrid ( TopicEndpointUri = "eventgridUri" , TopicKeySetting = "eventgridKey" ) ] out JObject [ ] jobjects )
647701 {
648702 jobjects = new JObject [ 5 ] ;
@@ -683,6 +737,18 @@ public void SingleEventString([EventGrid(TopicEndpointUri = "eventgridUri", Topi
683737 }" ;
684738 }
685739
740+ public void SingleEventBinaryData ( [ EventGrid ( TopicEndpointUri = "eventgridUri" , TopicKeySetting = "eventgridKey" ) ] out BinaryData single )
741+ {
742+ single = new BinaryData ( @"
743+ {
744+ ""id"" : ""i"",
745+ ""data"" : ""0"",
746+ ""source"" : ""custom"",
747+ ""type"" : ""custom"",
748+ ""specversion"" : ""1.0""
749+ }" ) ;
750+ }
751+
686752 public void SingleEventJObject ( [ EventGrid ( TopicEndpointUri = "eventgridUri" , TopicKeySetting = "eventgridKey" ) ] out JObject single )
687753 {
688754 single = new JObject (
@@ -730,7 +796,6 @@ public async Task AsyncCollectorEvent([EventGrid(TopicEndpointUri = "eventgridUr
730796 }
731797 }
732798
733- // assume converter is applied correctly with other output binding types
734799 public void StringEvents ( [ EventGrid ( TopicEndpointUri = "eventgridUri" , TopicKeySetting = "eventgridKey" ) ] out string [ ] strings )
735800 {
736801 strings = new string [ 5 ] ;
@@ -747,6 +812,22 @@ public void StringEvents([EventGrid(TopicEndpointUri = "eventgridUri", TopicKeyS
747812 }
748813 }
749814
815+ public void BinaryDataEvents ( [ EventGrid ( TopicEndpointUri = "eventgridUri" , TopicKeySetting = "eventgridKey" ) ] out BinaryData [ ] data )
816+ {
817+ data = new BinaryData [ 5 ] ;
818+ for ( int i = 0 ; i < 5 ; i ++ )
819+ {
820+ data [ i ] = new BinaryData ( $@ "
821+ {{
822+ ""id"" : ""{ i } "",
823+ ""data"" : ""{ i } "",
824+ ""source"" : ""custom"",
825+ ""type"" : ""custom"",
826+ ""specversion"" : ""1.0""
827+ }}" ) ;
828+ }
829+ }
830+
750831 // assume converter is applied correctly with other output binding types
751832 public void JObjectEvents ( [ EventGrid ( TopicEndpointUri = "eventgridUri" , TopicKeySetting = "eventgridKey" ) ] out JObject [ ] jobjects )
752833 {
0 commit comments