Skip to content

Commit 7cac9d2

Browse files
authored
Added conent-type alias (#6)
1 parent 8bd43fa commit 7cac9d2

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

src/dotNet/ClientLib/OptionsParser.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ public void PrintHelp()
5353
this.WriteOptionDescriptions(Console.Out);
5454
}
5555

56-
protected static bool ParseBoolOption(string durable)
56+
protected static bool ParseBoolOption(string value)
5757
{
58-
if (durable == "yes" || durable == "true" || durable == "True")
58+
if (value == "yes" || value == "true" || value == "True")
5959
return true;
60-
if (durable == "no" || durable == "false" || durable == "False")
60+
if (value == "no" || value == "false" || value == "False")
6161
return false;
6262
throw new ArgumentException();
6363
}
@@ -358,7 +358,7 @@ public SenderOptions() : base()
358358
(int groupSequence) => { this.GroupSequence = groupSequence; });
359359
this.Add("msg-reply-to-group-id=", "amqp message reply to group id",
360360
(string replyToGroupId) => { this.ReplyToGroupId = replyToGroupId; });
361-
this.Add("msg-content-type=", "message content type; values string, int, long, float",
361+
this.Add("content-type=|msg-content-type=", "message content type; values string, int, long, float",
362362
(string contentType) => { this.ContentType = contentType; });
363363
this.Add("msg-content=", "specify a content",
364364
(string content) => { this.Content = content; });

test/ClientUnitTests/SendReceiveTests.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,5 +184,10 @@ public void TestSendReceiveTimeout()
184184
Assert.AreEqual(0, this.clientRunner.RunSender("--address timeout_queue --count 5 --timeout 5"));
185185
Task.WaitAll(timeoutReceiver);
186186
}
187+
[Test]
188+
public void TestMsgContentType()
189+
{
190+
Assert.AreEqual(0, this.clientRunner.RunSender("--address content_queue --count 5 --content-type int --msg-content 5"));
191+
}
187192
}
188193
}

test/NetCoreClientUnitTest/SendReceiveTests.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,5 +156,10 @@ public void TestSendReceiveTimeoutNetCore()
156156
Assert.AreEqual(0, this.clientRunner.RunSender("--address timeout_queue --count 5 --timeout 5"));
157157
Task.WaitAll(timeoutReceiver);
158158
}
159+
[TestMethod]
160+
public void TestMsgContentType()
161+
{
162+
Assert.AreEqual(0, this.clientRunner.RunSender("--address content_queue --count 5 --content-type int --msg-content 5"));
163+
}
159164
}
160165
}

0 commit comments

Comments
 (0)