@@ -62,5 +62,39 @@ public void TestBasicPublishBatchSend()
62
62
BasicGetResult resultB = Model . BasicGet ( "test-message-batch-b" , true ) ;
63
63
Assert . NotNull ( resultB ) ;
64
64
}
65
+
66
+ [ Test ]
67
+ public void TestBasicPublishBatchSendWithSizeHint ( )
68
+ {
69
+ Model . ConfirmSelect ( ) ;
70
+ Model . QueueDeclare ( queue : "test-message-batch-a" , durable : false ) ;
71
+ Model . QueueDeclare ( queue : "test-message-batch-b" , durable : false ) ;
72
+ IBasicPublishBatch batch = Model . CreateBasicPublishBatch ( 2 ) ;
73
+ batch . Add ( "" , "test-message-batch-a" , false , null , new byte [ ] { } ) ;
74
+ batch . Add ( "" , "test-message-batch-b" , false , null , new byte [ ] { } ) ;
75
+ batch . Publish ( ) ;
76
+ Model . WaitForConfirmsOrDie ( TimeSpan . FromSeconds ( 15 ) ) ;
77
+ BasicGetResult resultA = Model . BasicGet ( "test-message-batch-a" , true ) ;
78
+ Assert . NotNull ( resultA ) ;
79
+ BasicGetResult resultB = Model . BasicGet ( "test-message-batch-b" , true ) ;
80
+ Assert . NotNull ( resultB ) ;
81
+ }
82
+
83
+ [ Test ]
84
+ public void TestBasicPublishBatchSendWithWrongSizeHint ( )
85
+ {
86
+ Model . ConfirmSelect ( ) ;
87
+ Model . QueueDeclare ( queue : "test-message-batch-a" , durable : false ) ;
88
+ Model . QueueDeclare ( queue : "test-message-batch-b" , durable : false ) ;
89
+ IBasicPublishBatch batch = Model . CreateBasicPublishBatch ( 1 ) ;
90
+ batch . Add ( "" , "test-message-batch-a" , false , null , new byte [ ] { } ) ;
91
+ batch . Add ( "" , "test-message-batch-b" , false , null , new byte [ ] { } ) ;
92
+ batch . Publish ( ) ;
93
+ Model . WaitForConfirmsOrDie ( TimeSpan . FromSeconds ( 15 ) ) ;
94
+ BasicGetResult resultA = Model . BasicGet ( "test-message-batch-a" , true ) ;
95
+ Assert . NotNull ( resultA ) ;
96
+ BasicGetResult resultB = Model . BasicGet ( "test-message-batch-b" , true ) ;
97
+ Assert . NotNull ( resultB ) ;
98
+ }
65
99
}
66
100
}
0 commit comments