-
Notifications
You must be signed in to change notification settings - Fork 2
TUnit Support #2
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
Conversation
There will be a v1. But Rider and VS have some issues still with the new Microsoft Testing Platform. So I want to wait for those fixes before I release v1, because I don't want to do an "official" release and it be an unpleasant experience for some people. |
@thomhurst I see. In this case I'll release the package under a zero-based version as well until you publish v1. |
@aivascu Did you review this? |
@thomhurst hi, yeah kinda. I was just doing some changes to it. |
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.
@thomhurst I'm going to push a few changes in a bit. Building the project in validation mode with all code style rules enabled, and .NET 8, kinda sent me down a rabbit hole of refactoring. )
There is one more issue I found in TUnit's source generator file StackTraceHiddenAttribute
. This class uses the C# 12 bodyless class declaration (can't remember what it's called), that is not available for when building against older SDKs.
IMO since TUnit supports .NET Standard 2.0 I think it should also support use the version of the C# syntax available at the time when it came out (i.e. C# 8.0).
I haven't checked yet but it's likely that a test project on .NET Framework 4.8 with older build build tools might not be able to build TUnit tests.
tests/AutoFixture.TUnit.Tests/MemberAutoDataAttributeScenarioTests.cs
Outdated
Show resolved
Hide resolved
Do you mean file scoped namespaces? |
No, I mean declarations like |
@thomhurst the generated file I mentioned looks like below. I couldn't reproduce a syntax error under older SDKs since it was not generated. Probably because the polyfill is not necessary under those targets? namespace System.Diagnostics;
using System;
using System.Diagnostics.CodeAnalysis;
[AttributeUsage(
AttributeTargets.Class |
AttributeTargets.Method |
AttributeTargets.Constructor |
AttributeTargets.Struct,
Inherited = false)]
sealed class StackTraceHiddenAttribute : Attribute; I could however reproduce a primary constructor syntax error when I set the language version to 10 while building under .NET 8.0 SDK.
and the namespace error when I set the language version even lower.
IMO auto-generated code should be as unambiguous and backward compatible as possible. namespace System.Diagnostics
{
[global::System.AttributeUsage(
global::System.AttributeTargets.Class |
global::System.AttributeTargets.Method |
global::System.AttributeTargets.Constructor |
global::System.AttributeTargets.Struct,
Inherited = false)]
internal sealed class StackTraceHiddenAttribute : global::System.Attribute
{
}
} |
I'll add it to my to-do list to make it more legacy friendly |
Apart from that, is the rest of the pr okay? |
I think so, yes. I should have some time near eow to finish the changes and merge the PR. |
Description
A project/package for easy integration with the TUnit testing framework.
Closed issues
#1
Checklist