NightOwl888 commented on code in PR #897:
URL: https://github.com/apache/lucenenet/pull/897#discussion_r1462122480


##########
src/Lucene.Net.Tests/Util/Packed/TestPackedInts.cs:
##########
@@ -7,7 +7,6 @@
 using System.Collections.Generic;
 using System.Globalization;
 using JCG = J2N.Collections.Generic;
-using Assert = Lucene.Net.TestFramework.Assert;

Review Comment:
   We ended up putting these in every file because we don't know how each file 
will change in the future, and I was unaware of a global option. But I asked 
ChatGPT and it seems there is a way to move `using Assert = 
Lucene.Net.TestFramework.Assert;` to the global level.
   
   ```c#
   // Create a global alias for Lucene.Net.Testframework
   using global::Assert = Lucene.Net.Testframework.Assert;
   ```
   
   In other files in the project, you can use `Assert` without specifying the 
namespace, and it will refer to `Lucene.Net.Testframework.Assert`.
   
   So, let's leave this alone in this PR and afterward, we can add add a file 
for global asserts in all tests and another file for global asserts in all 
projects (because the alias for `Console` should work everywhere). There may be 
others that I can't think of off of the top of my head. This definitely beats 
maintaining an import at the top of every single file.
   
   It more than doubled our testing performance by making our own asserts, so 
this is something we don't want to leave to chance that someone will add and/or 
keep the import - we want it imported automatically.



-- 
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: dev-unsubscr...@lucenenet.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to