C# 11 || [CollectionDefinition<MyCollectionFixtureType>]
Generic CollectionDefinitionAttribute
functionality?
#2627
Answered
by
bradwilson
jeffward01
asked this question in
General
-
I reviewed the code and I do not think this feature exists, but I just wanted to ask anyways. QuestionIs it possible to use Here is the current documentation for Example:Current[CollectionDefinition("Database collection")]
public class DatabaseCollection : ICollectionFixture<DatabaseFixture>
{
// This class has no code, and is never created. Its purpose is simply
// to be the place to apply [CollectionDefinition] and all the
// ICollectionFixture<> interfaces.
}
[Collection("Database collection")]
public class DatabaseTestClass1
{
DatabaseFixture fixture;
public DatabaseTestClass1(DatabaseFixture fixture)
{
this.fixture = fixture;
}
} Expected C# 11 functionality[CollectionDefinition<DatabaseCollection>]
public class DatabaseCollection : ICollectionFixture<DatabaseFixture>
{
// This class has no code, and is never created. Its purpose is simply
// to be the place to apply [CollectionDefinition] and all the
// ICollectionFixture<> interfaces.
}
[Collection<DatabaseCollection>]
public class DatabaseTestClass1
{
DatabaseFixture fixture;
public DatabaseTestClass1(DatabaseFixture fixture)
{
this.fixture = fixture;
}
} Summary
|
Beta Was this translation helpful? Give feedback.
Answered by
bradwilson
Jan 22, 2023
Replies: 1 comment
-
It is not possible today. I would have to see how this is implemented to know whether we could do it without making C# 11 the minimum language version for xUnit.net. I will convert this to an issue for you. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
bradwilson
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It is not possible today.
I would have to see how this is implemented to know whether we could do it without making C# 11 the minimum language version for xUnit.net. I will convert this to an issue for you.
#2650