Skip to content

Commit 628aeda

Browse files
Add a test for IModel#ConfirmSelect idempotency
1 parent 53b38ab commit 628aeda

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
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-2013 GoPivotal, Inc. All rights reserved.
39+
//---------------------------------------------------------------------------
40+
41+
using NUnit.Framework;
42+
43+
using System;
44+
using System.Text;
45+
46+
namespace RabbitMQ.Client.Unit {
47+
[TestFixture]
48+
public class TestConfirmSelect : IntegrationFixture {
49+
protected UTF8Encoding enc = new UTF8Encoding();
50+
51+
[Test]
52+
public void TestConfirmSelectIdempotency()
53+
{
54+
Model.ConfirmSelect();
55+
Assert.AreEqual(1, Model.NextPublishSeqNo);
56+
Publish();
57+
Assert.AreEqual(2, Model.NextPublishSeqNo);
58+
Publish();
59+
Assert.AreEqual(3, Model.NextPublishSeqNo);
60+
61+
Model.ConfirmSelect();
62+
Publish();
63+
Assert.AreEqual(4, Model.NextPublishSeqNo);
64+
Publish();
65+
Assert.AreEqual(5, Model.NextPublishSeqNo);
66+
Publish();
67+
Assert.AreEqual(6, Model.NextPublishSeqNo);
68+
}
69+
70+
protected void Publish()
71+
{
72+
Model.BasicPublish("", "amq.fanout", null, enc.GetBytes("message"));
73+
}
74+
}
75+
}

0 commit comments

Comments
 (0)