Skip to content

Commit ea8f5cd

Browse files
Initial test for publisher confirms API in IModel
1 parent b9bdfa1 commit ea8f5cd

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

projects/client/Unit/RabbitMQ.Client.Unit.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@
124124
<Compile Include="src\unit\TestPassiveDeclare.cs" />
125125
<Compile Include="src\unit\TestPropertiesClone.cs" />
126126
<Compile Include="src\unit\TestPublicationAddress.cs" />
127+
<Compile Include="src\unit\TestPublisherConfirms.cs" />
127128
<Compile Include="src\unit\TestQueueDeclare.cs" />
128129
<Compile Include="src\unit\TestRecoverAfterCancel.cs" />
129130
<Compile Include="src\unit\TestSharedQueue.cs" />
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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-2015 Pivotal Software, 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-2015 Pivotal Software, Inc. All rights reserved.
39+
//---------------------------------------------------------------------------
40+
41+
using NUnit.Framework;
42+
using System;
43+
using RabbitMQ.Client;
44+
45+
namespace RabbitMQ.Client.Unit
46+
{
47+
[TestFixture]
48+
public class TestPublisherConfirms : IntegrationFixture
49+
{
50+
[Test]
51+
public void TestWaitForConfirmsWithoutTimeout()
52+
{
53+
var ch = Conn.CreateModel();
54+
ch.ConfirmSelect();
55+
56+
var q = ch.QueueDeclare().QueueName;
57+
58+
for (int i = 0; i < 200; i++)
59+
{
60+
ch.BasicPublish("", q, null, encoding.GetBytes("msg"));
61+
}
62+
Assert.IsTrue(ch.WaitForConfirms());
63+
ch.QueueDelete(q);
64+
ch.Close();
65+
}
66+
}
67+
}

0 commit comments

Comments
 (0)