50
50
using RabbitMQ . Client . Impl ;
51
51
using RabbitMQ . Util ;
52
52
53
- namespace RabbitMQ . Client . Unit
54
- {
53
+ namespace RabbitMQ . Client . Unit {
55
54
[ TestFixture ]
56
- public class TestConsumerCancelNotify
57
- {
55
+ public class TestConsumerCancelNotify {
58
56
59
57
Object lockObject = new Object ( ) ;
60
58
bool notified = false ;
61
59
62
60
[ Test ]
63
- public void TestConsumerCancelNotification ( )
64
- {
61
+ public void TestConsumerCancelNotification ( ) {
65
62
string queue = "queue_consumer_notify" ;
66
63
ConnectionFactory connFactory = new ConnectionFactory ( ) ;
67
64
IConnection conn = connFactory . CreateConnection ( ) ;
@@ -71,10 +68,8 @@ public void TestConsumerCancelNotification()
71
68
chan . BasicConsume ( queue , false , consumer ) ;
72
69
73
70
chan . QueueDelete ( queue ) ;
74
- lock ( lockObject )
75
- {
76
- if ( ! notified )
77
- {
71
+ lock ( lockObject ) {
72
+ if ( ! notified ) {
78
73
Monitor . Wait ( lockObject ) ;
79
74
}
80
75
Assert . IsTrue ( notified ) ;
@@ -85,15 +80,12 @@ public class CancelNotificationConsumer : QueueingBasicConsumer
85
80
{
86
81
TestConsumerCancelNotify testClass ;
87
82
88
- public CancelNotificationConsumer ( IModel model , TestConsumerCancelNotify tc ) : base ( model )
89
- {
83
+ public CancelNotificationConsumer ( IModel model , TestConsumerCancelNotify tc ) : base ( model ) {
90
84
this . testClass = tc ;
91
85
}
92
86
93
- public override void HandleBasicCancel ( string consumerTag )
94
- {
95
- lock ( testClass . lockObject )
96
- {
87
+ public override void HandleBasicCancel ( string consumerTag ) {
88
+ lock ( testClass . lockObject ) {
97
89
testClass . notified = true ;
98
90
Monitor . PulseAll ( testClass . lockObject ) ;
99
91
}
0 commit comments