Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@plioi
Copy link
Contributor

@plioi plioi commented Dec 9, 2023

This enables implicit using directives as well as one custom explicit global using directive.

As indicated in the commit messages, much of this work was performed by automated refactorings.

Manual Changes:

  1. Applying <ImplicitUsings>enable</ImplicitUsings> to all projects.
  2. Manually adjusted the directives at the top of TestClassConstructionTests, as the order of namespace vs using was unintentionally missed in Using Directive Placement #312 and prevented automated refactoring from being applicable.
  3. SourceLocationSamples is by its nature brittle in the face of line number changes, so this adds a descriptive comment to that effect near the top, "coincidentally" returning all brittle-positioned lines back to their original location. Doing so prevents having to manually adjust all the line number comments and associated assertion constants in SourceLocationProviderTests.
  4. Revert the automatic application of implicit using from the special file Fixie.Main.cs, which is included in the NuGet package and automatically included in end users' own test assemblies. Since end users may or may not have implicit using enabled, we have to err on the safe side to ensure all users can actually build their test projects.

Custom Global Using:

  1. The global using feature could easily be overused to the point of regret, but I've included one in the tests project. Nearly all code files in the tests project naturally need to make assertions, and since they are of the a.ShouldXyz(b) extension method variety, implicitly including their namespace removes realistic friction when writing the first assertion in a new test file:
    global using Fixie.Tests.Assertions;

plioi added 6 commits December 9, 2023 14:15
…icitUsings.

This entire change was performed by an automated refactoring.
…ented automatic cleanup of redundant `using` directive.
…e namespace `Fixie.Assertions` to a `global using` directive.

This entire change was performed by an automated refactoring.
…ionSamples, accounting for how these naturally-brittle positions were altered by recent changes to `using` and `namespace` directives.
…al packaged file `Fixie.Main.cs`, which gets placed in end users' solutions where implicit `using` directives may or may not be enabled.
@plioi plioi marked this pull request as ready for review December 9, 2023 21:14
@plioi plioi merged commit ebf0e97 into main Dec 9, 2023
@plioi plioi deleted the global-using-directives branch December 9, 2023 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants