Skip to content

Commit 45ae533

Browse files
Add test file missing from the previous commit
1 parent 0ed4bb5 commit 45ae533

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
// This source code is dual-licensed under the Apache License, version
2+
// 2.0, and the Mozilla Public License, version 1.1.
3+
//
4+
// The APL v2.0:
5+
//
6+
//---------------------------------------------------------------------------
7+
// Copyright (C) 2007-2013 GoPivotal, Inc.
8+
//
9+
// Licensed under the Apache License, Version 2.0 (the "License");
10+
// you may not use this file except in compliance with the License.
11+
// You may obtain a copy of the License at
12+
//
13+
// http://www.apache.org/licenses/LICENSE-2.0
14+
//
15+
// Unless required by applicable law or agreed to in writing, software
16+
// distributed under the License is distributed on an "AS IS" BASIS,
17+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
// See the License for the specific language governing permissions and
19+
// limitations under the License.
20+
//---------------------------------------------------------------------------
21+
//
22+
// The MPL v1.1:
23+
//
24+
//---------------------------------------------------------------------------
25+
// The contents of this file are subject to the Mozilla Public License
26+
// Version 1.1 (the "License"); you may not use this file except in
27+
// compliance with the License. You may obtain a copy of the License
28+
// at http://www.mozilla.org/MPL/
29+
//
30+
// Software distributed under the License is distributed on an "AS IS"
31+
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
32+
// the License for the specific language governing rights and
33+
// limitations under the License.
34+
//
35+
// The Original Code is RabbitMQ.
36+
//
37+
// The Initial Developer of the Original Code is GoPivotal, Inc.
38+
// Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved.
39+
//---------------------------------------------------------------------------
40+
41+
using NUnit.Framework;
42+
43+
using System;
44+
using System.Text;
45+
using System.Threading;
46+
using System.Diagnostics;
47+
48+
using RabbitMQ.Client.Events;
49+
using RabbitMQ.Client.MessagePatterns;
50+
51+
namespace RabbitMQ.Client.Unit {
52+
[TestFixture]
53+
public class TestMessagePatternsSubscription : IntegrationFixture {
54+
UTF8Encoding enc = new UTF8Encoding();
55+
56+
[Test]
57+
public void TestChannelClosureIsObservableOnSubscription()
58+
{
59+
string q = Model.QueueDeclare();
60+
Subscription sub = new Subscription(Model, q, true);
61+
62+
BasicDeliverEventArgs r1;
63+
Assert.IsFalse(sub.Next(100, out r1));
64+
65+
Model.BasicPublish("", q, null, enc.GetBytes("a message"));
66+
Model.BasicPublish("", q, null, enc.GetBytes("a message"));
67+
68+
BasicDeliverEventArgs r2;
69+
Assert.IsTrue(sub.Next(1000, out r2));
70+
Assert.IsNotNull(sub.Next());
71+
72+
Model.Close();
73+
Assert.IsNull(sub.Next());
74+
75+
BasicDeliverEventArgs r3;
76+
Assert.IsFalse(sub.Next(100, out r3));
77+
}
78+
}
79+
}

0 commit comments

Comments
 (0)