@@ -87,30 +87,40 @@ await daprClient.BulkPublishEventAsync(TestPubsubName, TestTopicName, bulkPublis
87
87
request . Dismiss ( ) ;
88
88
89
89
var envelope = await request . GetRequestEnvelopeAsync < Autogenerated . BulkPublishRequest > ( ) ;
90
-
90
+
91
91
envelope . Entries . Count . ShouldBe ( 2 ) ;
92
92
envelope . PubsubName . ShouldBe ( TestPubsubName ) ;
93
93
envelope . Topic . ShouldBe ( TestTopicName ) ;
94
94
95
+ //Validate that the metadata is on the envelope
95
96
envelope . Metadata . Count . ShouldBe ( 2 ) ;
96
97
envelope . Metadata . Keys . Contains ( "key1" ) . ShouldBeTrue ( ) ;
97
98
envelope . Metadata . Keys . Contains ( "key2" ) . ShouldBeTrue ( ) ;
98
99
envelope . Metadata [ "key1" ] . ShouldBe ( "value1" ) ;
99
100
envelope . Metadata [ "key2" ] . ShouldBe ( "value2" ) ;
100
101
102
+ //Validate that the metadata is also on each entry
101
103
var firstEntry = envelope . Entries [ 0 ] ;
102
104
103
105
firstEntry . EntryId . ShouldBe ( "0" ) ;
104
106
firstEntry . ContentType . ShouldBe ( TestContentType ) ;
105
107
firstEntry . Event . ToStringUtf8 ( ) . ShouldBe ( JsonSerializer . Serialize ( bulkPublishData [ 0 ] , client . InnerClient . JsonSerializerOptions ) ) ;
106
- firstEntry . Metadata . ShouldBeEmpty ( ) ;
108
+ firstEntry . Metadata . Keys . Count . ShouldBe ( 2 ) ;
109
+ firstEntry . Metadata . ContainsKey ( "key1" ) . ShouldBeTrue ( ) ;
110
+ firstEntry . Metadata [ "key1" ] . ShouldBe ( "value1" ) ;
111
+ firstEntry . Metadata . ContainsKey ( "key2" ) . ShouldBeTrue ( ) ;
112
+ firstEntry . Metadata [ "key2" ] . ShouldBe ( "value2" ) ;
107
113
108
114
var secondEntry = envelope . Entries [ 1 ] ;
109
115
110
116
secondEntry . EntryId . ShouldBe ( "1" ) ;
111
117
secondEntry . ContentType . ShouldBe ( TestContentType ) ;
112
118
secondEntry . Event . ToStringUtf8 ( ) . ShouldBe ( JsonSerializer . Serialize ( bulkPublishData [ 1 ] , client . InnerClient . JsonSerializerOptions ) ) ;
113
- secondEntry . Metadata . ShouldBeEmpty ( ) ;
119
+ secondEntry . Metadata . Keys . Count . ShouldBe ( 2 ) ;
120
+ secondEntry . Metadata . ContainsKey ( "key1" ) . ShouldBeTrue ( ) ;
121
+ secondEntry . Metadata [ "key1" ] . ShouldBe ( "value1" ) ;
122
+ secondEntry . Metadata . ContainsKey ( "key2" ) . ShouldBeTrue ( ) ;
123
+ secondEntry . Metadata [ "key2" ] . ShouldBe ( "value2" ) ;
114
124
115
125
// Create Response & Respond
116
126
var response = new Autogenerated . BulkPublishResponse
@@ -183,25 +193,35 @@ await daprClient.BulkPublishEventAsync(TestPubsubName, TestTopicName, bulkPublis
183
193
envelope . PubsubName . ShouldBe ( TestPubsubName ) ;
184
194
envelope . Topic . ShouldBe ( TestTopicName ) ;
185
195
196
+ //Validate the metadata on the envelope
186
197
envelope . Metadata . Count . ShouldBe ( 2 ) ;
187
198
envelope . Metadata . Keys . Contains ( "key1" ) . ShouldBeTrue ( ) ;
188
199
envelope . Metadata . Keys . Contains ( "key2" ) . ShouldBeTrue ( ) ;
189
200
envelope . Metadata [ "key1" ] . ShouldBe ( "value1" ) ;
190
201
envelope . Metadata [ "key2" ] . ShouldBe ( "value2" ) ;
191
202
203
+ //Validate the metadata on each entry
192
204
var firstEntry = envelope . Entries [ 0 ] ;
193
205
194
206
firstEntry . EntryId . ShouldBe ( "0" ) ;
195
207
firstEntry . ContentType . ShouldBe ( TestContentType ) ;
196
208
firstEntry . Event . ToStringUtf8 ( ) . ShouldBe ( JsonSerializer . Serialize ( bulkPublishData [ 0 ] , client . InnerClient . JsonSerializerOptions ) ) ;
197
- firstEntry . Metadata . ShouldBeEmpty ( ) ;
209
+ firstEntry . Metadata . Keys . Count . ShouldBe ( 2 ) ;
210
+ firstEntry . Metadata . ContainsKey ( "key1" ) . ShouldBeTrue ( ) ;
211
+ firstEntry . Metadata [ "key1" ] . ShouldBe ( "value1" ) ;
212
+ firstEntry . Metadata . ContainsKey ( "key2" ) . ShouldBeTrue ( ) ;
213
+ firstEntry . Metadata [ "key2" ] . ShouldBe ( "value2" ) ;
198
214
199
215
var secondEntry = envelope . Entries [ 1 ] ;
200
216
201
217
secondEntry . EntryId . ShouldBe ( "1" ) ;
202
218
secondEntry . ContentType . ShouldBe ( TestContentType ) ;
203
219
secondEntry . Event . ToStringUtf8 ( ) . ShouldBe ( JsonSerializer . Serialize ( bulkPublishData [ 1 ] , client . InnerClient . JsonSerializerOptions ) ) ;
204
- secondEntry . Metadata . ShouldBeEmpty ( ) ;
220
+ secondEntry . Metadata . Keys . Count . ShouldBe ( 2 ) ;
221
+ secondEntry . Metadata . ContainsKey ( "key1" ) . ShouldBeTrue ( ) ;
222
+ secondEntry . Metadata [ "key1" ] . ShouldBe ( "value1" ) ;
223
+ secondEntry . Metadata . ContainsKey ( "key2" ) . ShouldBeTrue ( ) ;
224
+ secondEntry . Metadata [ "key2" ] . ShouldBe ( "value2" ) ;
205
225
206
226
// Create Response & Respond
207
227
var response = new Autogenerated . BulkPublishResponse
@@ -336,4 +356,4 @@ private class Widget
336
356
public string Size { get ; set ; }
337
357
public string Color { get ; set ; }
338
358
}
339
- }
359
+ }
0 commit comments