Skip to content

Implicit usings and file scoped namespaces #1547

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
4 tasks
lipchev opened this issue Apr 17, 2025 · 2 comments
Open
4 tasks

Implicit usings and file scoped namespaces #1547

lipchev opened this issue Apr 17, 2025 · 2 comments

Comments

@lipchev
Copy link
Collaborator

lipchev commented Apr 17, 2025

Here's what I'm thinking:

  • file scoped namespaces : nothing controversial here (I hope)
  • implicit usings in UnitsNet - I'm thinking of System, System.Collections.Generic, System.Numerics (net8+) and our Units namespace
  • implicit usings in the test projects: same as above + System.Linq and Xunit
  • adding the JetBrains.Annotations package and annotating the tests with the [TestSubject(..)] annotation (not sure how useful this is in practice, but still better than nothing I guess).
@angularsen
Copy link
Owner

angularsen commented Apr 18, 2025

Everything except JetBrains.Annotations, just go for it. These are internal matters and we can YOLO a bit here.

JetBrains.Annotations I feel is not so much used anymore, it was mostly useful for nullability which is now supported by the framework.

An alternative to TestSubject is simply add xmldoc with <see cref="TheImplementation" /> and you'll have a nice clickable link to the class you're testing.

@lipchev
Copy link
Collaborator Author

lipchev commented Apr 18, 2025

I'm not 100% sure, but I suspect the AI might be using it (I noticed it was adding it when I use "Generate tests")- I still haven't tried it but my hope is that it would be able to "append" tests to the existing test files (directly using the context menu).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants