Comments (7)
There is a neat trick for this scenarios.
It is possible to multitarget the project so the resulting nuget package will be compatible with .net core 2.x and 3.x also. I can work this on tomorrow.
(Regardless I still recommend this to be a 3.0 version.)
from fluentassertions.aspnetcore.mvc.
I finished with the multi-targeting.
In the end only one breaking change in the 3.0:
The type of JsonResult.SerializerSettings changed from JsonSerializerSettings to object, therefore in the 3.0 target this also changes on JsonResultAssertions. In 2.0 remains the same so it won't break anything.
Now I working on the assertions for IConvertToActionResult.
from fluentassertions.aspnetcore.mvc.
I read little more into the ActionResult and I found it is actually introduced in .net core 2.1.
I think the assertions for this should also be supported from that version.
Also as I read this is a wrapper that help swagger to better determine the possible outcomes of the action like 200 and then concrete a type for the api or some error status code. I am still thinking how should the api look like considering this.
Here is an official description: https://docs.microsoft.com/en-us/aspnet/core/web-api/action-return-types?view=aspnetcore-3.1#actionresultt-type
from fluentassertions.aspnetcore.mvc.
I tested multitargeting and it didn't work as I expected. Although the runtime version deployed beside the test project is the closest to the project version, the compile time and intellisense always falls back to the netstandard2.0. This means the new Should method won't be visible.
It is possible to solve this issue with MSBuild.Sdk.Extras.
What should be done? Should I use this or is it ok to drop support for older versions of .net? This also would mean that the project should target .net core not standard.
from fluentassertions.aspnetcore.mvc.
@faddiv I'm a little out of touch with the MS ecosystem at the moment, so I'm a bit confused as to what they are doing with the version numbers now...
It seems the main Microsoft.AspNetCore.Mvc package we depend on is still on version 2.2 and hasn't been updated since 2018. Does that seem correct?
And, the release on their github repro now seem to be tied to a .net core version?
Do you know what package ID they are using now to publish MVC Core?
Moving on, my rule of thumb for libs like ours in the past was twofold:
- target the lowest and broadest set of TFMs possible, in our case
netstandard2.0
- depend on the lowest upstream nuget possible, in our case
[email protected]
If we need to take a new major version of any of the above, I would call that a breaking change and we'd ship a new major version too.
So where does that leave us?
According to the docs here, netstandard2.1
is the latest version and that is implemented by .net core 3.0.
And from looking through the MVC Core sources, it looks like they target netcoreapp3.1
.
I think it makes sense for us to target the same TFM as Microsoft. The fact that we are targeting a more generic TFM maybe a contributing factor to #15.
Thoughts? I don't feel like I've answered your question, but hopefully we can figure out the way forward.
from fluentassertions.aspnetcore.mvc.
The Microsoft.AspNetCore.Mvc won't be updated because starting from .net core 3 it is part of the framework and it is only available for netcoreapp3.x.
Also using netstandard2.1 is not recommended because it is not compatible with .net framework.
The only necessary thing to support the generic ActionResult and solve #15 is to update the mvc package to 2.1. This actually isn't a bad idea since from the net core 2.x the only supported version is 2.1.
What I tried originally is multitargeting the package but it works only if the api the same in every target which is not. I only found MSBuild.Sdk.Extras as possible solution but I'm unsure if it works on the build system. Also this will complicate the project structure and I unsure if this really worth it.
from fluentassertions.aspnetcore.mvc.
In the end I decided in both route:
First I updated the asp.net mvc core from 2.0 to 2.1. Reason: It is not sensible to use 2.0 since the support is long ended and anyway this update is easy.
Second I applied the MSBuild.Sdk.Extras so the package will be fully compatible .net core 2.x and 3.x also.
I dont pull yet because I need to figure out what api should be best for testing the generic ActionResult to solve #15.
from fluentassertions.aspnetcore.mvc.
Related Issues (9)
- ActionResultExtensions are not working for Web API projects HOT 6
- New maintainers HOT 23
- Poor support for 'ActionResult<T>' type? HOT 2
- Nuget key expired HOT 3
- Add shorthand support for typed ObjectResult assertions HOT 3
- Better support for `ActionResult<T>` HOT 1
- Upgrade to Fluent Assertions 5 HOT 1
- Potential `Should().BeRedirectAction(string action)` assertions HOT 2
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 fluentassertions.aspnetcore.mvc.