Comments (7)
They are still there, just under a name ClassicAssert. And if you want that to use the Assert, you can actually change that yourself using an alias, ref Using global using aliases, either as a global alias in the GlobalUsings.cs file, or directly in the csproj file.
global using Assert = NUnit.Framework.Legacy.ClassicAssert;
or in the csproj
<Using Include="NUnit.Framework.Legacy.ClassicAssert" Alias="Assert" />
You can then still use the That syntax if you like, in some cases.
We have no intention of removing these, but I assume you have read that we can't evolve the classic asserts the way we can with the constraint aliases.
from nunit.
Why rename them though and break everyone who upgrades?
from nunit.
We had to move them into a separate project.
We also considered moving it into its own project, but that is now on ice. But splitting out all assertions, including constraints, into their own packages does have merit.
And when it is in its own project, we can't have the same class name.
If C# had allowed extension methods on static classes (which have been discussed for one, and also here ), we could have solved it that way.
Also, this is a version 4, it does come with breaking changes, and that's also why we have a Migration Guide.
from nunit.
Also, this is a version 4, it does come with breaking changes, and that's also why we have a Migration Guide.
According to the migration guide it states: "The analyzer code fix supports Batch Fixing:"
But how is that done and can it be done from cli?
I'm using Rider and can only do one line at a time, which is a problem, when you have 10k+ lines that needs to be converted to the new format.
from nunit.
Within Visual Studio you can apply a CodeFix to either a Document, a Project or a Solution.
An issue for Rider has been open for years.
It might be that dotnet format work on the command line, but I haven't tried it. See dotnet/roslyn#48561
from nunit.
@renemadsen
Are you on .NET6+ by chance? The link shared by @manfred-brands also includes a suggestion for something like this from CLI (though I have not tried it myself)
EDIT: Oops. I see the original comment had already been updated to reflect that
dotnet format analyzers --diagnostics=DIAG_ID_TO_FIX
from nunit.
Perhaps this can fix these things for us: https://devblogs.microsoft.com/dotnet/dotnet-build-2024-announcements/#c-13 - Extension types.
from nunit.
Related Issues (20)
- Increment StreamsComparer by 'Actual bytes read' rather than the buffer size
- Some release note between NUnit 2.6.4 and 3.14.0 should state the breaking change related to Trace and Debug output HOT 4
- Provide a ProgressTraceListener to redirect Trace output to the NUnit Progress output HOT 1
- Value equality on subset of object properties HOT 3
- Difference between net5.0/net6.0 and netframework 4.7.2 in test tear down HOT 5
- Either enable partial TestCaseSource combinatorial with Values, or document this is a limitation of TestCaseSource HOT 1
- Constraint helper classes modification request HOT 3
- State that the scope of a `SetUpFixture` is limited to an assembly HOT 2
- Possibilities to estimate the total test duration before starting the first test? HOT 13
- Provide a way to ignore a failed assertion HOT 14
- The dll's in the release 4.1 has version 4.0.1
- Missing possibility to retrieve a test's resulting `ParallelScope` HOT 1
- Improve PropertiesComparer diagnostics HOT 1
- Unexpected GreaterThan(NaN) behavior HOT 2
- AssemblySelectLimit does not work HOT 1
- Is.EqualTo stopped working after upgrade from 4.0.1 to 4.1.0 HOT 3
- Provide generic type definitions for `TestCaseData` to make it type safe. HOT 2
- Stacktrace calls lost on exception of type TargetInvocationException HOT 2
- Sections in Assert.Multiple HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nunit.