-
Notifications
You must be signed in to change notification settings - Fork 462
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
Cleanup unit tests #212
Cleanup unit tests #212
Conversation
Thank you so much! I'm always using AAA and FA in tests myself, and often use AF too. Tests in this project needed more love for a long time. The only change I'm not sure about is the downgrade from net462 to net461. |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
What is this failure @abatishchev ? 🤔 |
I think the latest is net472, not 473. Can you please try that one? It should succeed then and I'll merge right away |
Done ! |
Yay, thank you again! |
You're welcome ! Hope I can help in a near future ! |
If you'd like to contribute more, please help to convert the project with the .NET Framework version of tests to PackageReference/SDK-based, one of the item @glennawatson has planned to do in #211. Another option is to get rid off then altogether as I'm not quite sure they bring much value. What both of you think about this? |
I'm not very familiar with this but I would be glad to help ! |
The work has already been done just needs to separated into a separate pr |
https://github.com/jwt-dotnet/jwt/blob/84b4108d673b93eaee1aa5220fab14e2ff469d9f/tests/JWT.Tests.NETFramework/JWT.Tests.NETFramework.csproj is the file. Also delete the packages.config file |
I'll give it a look whenever I can |
Goal
How
I refactored most of the tests to normalize their redaction. Using the standard AAA testing and two tools to simplify them as much as possible.
In practice
Fluent Assertions
I used FluentAssertions, most of the tests are now way more readables and may surely allow newcomers to understand better and faster how to understand the underlying logic.
For example:
AutoFixture
https://github.com/AutoFixture/AutoFixture is a tool that allow us to specify a data type that we are going to use, without having to handle its initialization and writting magic data. It also bring more randomness in the unit tests and allow us to have a behaviour less predictable.
With this package, we can be focused only on the data we are working with and that matter for the test case.
For example: