devklick commented on code in PR #957:
URL: https://github.com/apache/lucenenet/pull/957#discussion_r1720734187
##########
src/Lucene.Net.Tests/Support/QueueExtensionsTests.cs:
##########
@@ -0,0 +1,94 @@
+using System.Collections.Generic;
+using NUnit.Framework;
+
+using Lucene.Net.Attributes;
+using Lucene.Net.Util;
+using Lucene.Net.Support;
+using System;
+
+
+namespace Lucene.Net
+{
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ public class QueueExtensionsTests : LuceneTestCase
+ {
+#if !FEATURE_QUEUE_TRYDEQUEUE_TRYPEEK
+ [Test, LuceneNetSpecific]
+ public void TryDequeue_ThrowsWhenQueueNull()
+ {
+ Queue<int> queue = null;
+ var ex = Assert.Throws<ArgumentNullException>(() =>
queue.TryDequeue(out int _));
+ Assert.That(ex.ParamName, Is.EqualTo("queue"));
Review Comment:
Apologies, I should have checked the existing tests to see what to use. I've
updated to use Lucene Assert now.
Note that since the Lucene equivalent doesnt cast the returned exception to
`T` (which I guess might be for performance reasons), I'm casting it to
`ArgumentNullException` within two of these tests to verify the `ParamName`.
Please let me know if I should avoid doing do. I notice that the existing tests
for `Assert.Throws<ArgumentNullException>` dont bother checking the
`ParamName`, so maybe this is overkill?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]