Class XunitTestAssembly
The default implementation of IXunitTestAssembly for xUnit.net v3.
public class XunitTestAssembly : IXunitTestAssembly, ITestAssembly, IAssemblyMetadata, IXunitSerializable
- Inheritance
-
XunitTestAssembly
- Implements
- Inherited Members
Constructors
XunitTestAssembly()
Called by the de-serializer; should only be called by deriving classes for de-serialization purposes
[Obsolete("Called by the de-serializer; should only be called by deriving classes for de-serialization purposes")]
public XunitTestAssembly()
XunitTestAssembly(Assembly, string?, Version?, string?)
Initializes a new instance of the XunitTestAssembly class.
public XunitTestAssembly(Assembly assembly, string? configFileName = null, Version? version = null, string? uniqueID = null)
Parameters
assemblyAssemblyThe test assembly.
configFileNamestringThe optional configuration filename
versionVersionThe version number of the assembly (defaults to "0.0.0.0")
uniqueIDstringThe unique ID for the test assembly (only used to override default behavior in testing scenarios)
Properties
Assembly
Gets the assembly of this test assembly.
public Assembly Assembly { get; }
Property Value
Remarks
This should only be used to execute a test assembly. All reflection should be abstracted here instead for better testability.
AssemblyFixtureTypes
Gets a list of fixture types associated with the test assembly.
public IReadOnlyCollection<Type> AssemblyFixtureTypes { get; }
Property Value
AssemblyName
Gets the assembly name. May return a simple assembly name (i.e., "mscorlib"), or may return a fully qualified name (i.e., "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089").
public string AssemblyName { get; }
Property Value
AssemblyPath
Gets the on-disk location of the assembly under test.
public string AssemblyPath { get; }
Property Value
BeforeAfterTestAttributes
Gets the IBeforeAfterTestAttributes attached to the test assembly.
public IReadOnlyCollection<IBeforeAfterTestAttribute> BeforeAfterTestAttributes { get; }
Property Value
CollectionBehavior
Gets the collection behavior associated with the assembly, if present.
public ICollectionBehaviorAttribute? CollectionBehavior { get; }
Property Value
CollectionDefinitions
Gets the collection definitions attached to the test assembly, by collection name.
public IReadOnlyDictionary<string, (Type Type, CollectionDefinitionAttribute Attribute)> CollectionDefinitions { get; }
Property Value
ConfigFilePath
Gets the full path of the configuration file name, if one is present.
May be null if there is no configuration file.
public string? ConfigFilePath { get; }
Property Value
ModuleVersionID
Returns the module version ID of the test assembly. Used as the basis for randomization.
public Guid ModuleVersionID { get; }
Property Value
TargetFramework
Gets the target framework the test assembly was compiled against. Will be in a form like ".NETFramework,Version=v4.7.2" or ".NETCoreApp,Version=v6.0".
public string TargetFramework { get; }
Property Value
TestCaseOrderer
Gets the test case orderer for the test assembly, if present.
public ITestCaseOrderer? TestCaseOrderer { get; }
Property Value
TestCollectionOrderer
Gets the test collection orderer for the test assembly, if present.
public ITestCollectionOrderer? TestCollectionOrderer { get; }
Property Value
Traits
Gets the trait values associated with this test assembly. If
there are none, or the framework does not support traits,
this should return an empty dictionary (not null).
public IReadOnlyDictionary<string, IReadOnlyCollection<string>> Traits { get; }
Property Value
UniqueID
Gets the unique ID for this test assembly.
public string UniqueID { get; }
Property Value
Remarks
The unique identifier for a test assembly should be able to discriminate among test assemblies with their associated configuration file (so the same assembly with two different configuration files should have two different unique IDs). This identifier should remain stable until such time as the developer changes some fundamental part of the identity. Recompilation of the test assembly is reasonable as a stability changing event.
Version
Gets the assembly version.
public Version Version { get; }
Property Value
Methods
Deserialize(IXunitSerializationInfo)
Called when the object should populate itself with data from the serialization info.
public void Deserialize(IXunitSerializationInfo info)
Parameters
infoIXunitSerializationInfoThe info to get the object data from
Serialize(IXunitSerializationInfo)
Called when the object should store its serialized values into the serialization info.
public void Serialize(IXunitSerializationInfo info)
Parameters
infoIXunitSerializationInfoThe info to store the object data into