-
Notifications
You must be signed in to change notification settings - Fork 589
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
Replace Nunit with xUnit #801
Replace Nunit with xUnit #801
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @asos-gurpreetsingh. The unit tests in this project are... insufficient to say the least.
Looking at the changes to NUnit, I'm inclined to decline this. Here's why
This new NUnit API is attempting to mimic Fluent Assertions but looks off. Take the following example:
Assert.That(false, Is.EqualTo(nonExistingValueAsFalse));
Every assertion has to have Assert.That()
as a container method. With Fluent Assertion, the same would be more readable.
nonExistingValueAsFalse.Should().BeFalse();
The benefits IMO are
- More fluid
- No "container method"
- Reads better for humans
I can support Fluent Assertions if you'd like. However, replacing an existing clunky NUnit API with another variant is not worth it.
Thanks @SeanFeldman , are we saying that if we update the Nunit package then we want to use fluent assertions otherwise we will never update Nunit package ? I am happy to use fluent assertions, I only took the path of least change in order to update nunit |
Is the new API mandatory for the latest version of NUnit? |
The old methods were not available when I updated. Anyway I will refactor to use fluent assertions, I would prefer that too |
Thanks, @asos-gurpreetsingh. |
Sure @SeanFeldman I will get the sorted. |
@SeanFeldman I have migrated this to XUnit. Could you please also have a look at the workflow (not my strong suite) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the switch to xUnit and the new assertions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of minor things. The xUnit changes look good.
I don't recall wherever PR build should have a version or not. @ErikMogensen do you remember? |
I added default input for workflow manual build that is what shows version number here, without this i cannot test build in feature branch, it could not find version release-version which is set as env variable. |
They do not have a version number so this is correct. |
Co-authored-by: Sean Feldman <[email protected]>
I tested to build this branch using |
@asos-gurpreetsingh, do you plan to complete this one? Erik pointed out one last thing that needs attention. |
Hi Yes I will pick this weekend, i was out on holiday |
In your test you have used very different version numbers, if our objective is to use something like 1.2.3.0 as assembly version and 1.2.3.566 as file version then this command would do that. But if we really want to set different versions like in you example then we can use another Property "FileVersion" for that |
Yes, we want to be able to set different versions. Thinking of this, I want the assembly version to be set using a file belonging to the project of the affected assembly instead of being set in the pipeline. |
There is also an issue with the build. |
Can I ask why ? |
set default value for release for testing manual builds
build is fixed. |
Of course. Assembly version is used by the .NET runtime to determine and verify it is loading the intended assembly. The assembly number of a dependent assembly is stored in the manifest of the calling assembly. By default it will only load that assembly. File version may be used for installers to determine which version an assembly has so the numbers have different purposes. By setting all the assemblies built in a build to have the same file version it is easy to tell for an installer and a human which build a certain assembly belongs to. Typically you do not want to change the assembly version in every build since that would make assemblies between two different builds incompatible. The exception to this if you have made changes in the assembly that lost its backward combability, then it should increase its assembly number. Does this PR still set the assembly version to the same value on all assemblies? |
Thanks, @ErikMogensen . I understand now why one could want different versions but I am not sure we SBE uses it with that intent. But with current state of build task "dotnet build ....." allows us to use different versions for file and assembly but that will be applied to all assemblies. I don't think this we ever set up to use different file versions for each project. That can be done by setting those in the project files. Secondly if that is what we want then we can pick this up in another change and not this one. |
We should probably have updated the assembly numbers in some PRs.
We don't want to have different file versions for assemblies in the same build so that's fine.
All work on this tool is voluntarily so there is quite a big risk that such a change will never be created. What is the problem with using msbuild for building? |
Apologies @ErikMogensen if I am missing something. when you say "I want the assembly version to be set using a file belonging to the project of the affected assembly instead of being set in the pipeline. " what is that to do with MSBuild or dotnet build ? and secondly "using a file belonging to the project of the affected assembly" sounds contradicting to "We don't want to have different file versions for assemblies". Could you please elaborate. Thanks |
I assumed dotnet build cannot handle assembly version set in a project since you changed the way assembly versions were set. But if it is possible to set assembly versions using files belonging to each project and still use dotnet build, it would be great.
It is about File version vs Assembly version. We want to have the same File version on all assemblies created by the build. We want Assembly version set separately for each assembly. Just ask again if it is unclear. |
Thanks @ErikMogensen . In that case file version can be set by dotnet build, but setting different assembly versions for each assembly would mean updating project files manually when needed. What assembly version should we set to start with ? when would it be changed (on what basis) |
Great!
Look with the ones that are in the main branch. (I believe all are 1.0.0,0 which is most likely not right.) Since this PR changed the .NET version, increment the major version digit (the first one).
They should be increased when there is new release of the assembly with an interface that is not backwards compatible. By interface I mean, public methods, properties, interfaces, events and delegates. (I may have forgotten one or two.) Also, if the runtime requirements change I consider that a change that should increase the version number. |
@ErikMogensen I have set set the assembly versions to 1.0.0.1 in all projects and build script will provide the file version. We should be able to change the assembly versions from projects now. I have updated the tests to reflect that too. Please check if this works as you expected. Could you also confirm that the publish process is not affected by this. (i have checked and it does not look like it should be affected, but please check). |
Well done @asos-gurpreetsingh ! |
No description provided.