TestAssembly
TestAssembly is a TestSuite that represents the execution
of tests in a managed assembly.
using NUnit.Framework.Interfaces;
using System;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
namespace NUnit.Framework.Internal
{
[System.Runtime.CompilerServices.NullableContext(1)]
[System.Runtime.CompilerServices.Nullable(0)]
public class TestAssembly : TestSuite
{
[System.Runtime.CompilerServices.Nullable(2)]
[field: System.Runtime.CompilerServices.Nullable(2)]
public Assembly Assembly {
[System.Runtime.CompilerServices.NullableContext(2)]
get;
}
public override string TestType => "Assembly";
public TestAssembly(Assembly assembly, string assemblyNameOrPath)
: this(assemblyNameOrPath)
{
Assembly = assembly;
}
public TestAssembly(string assemblyNameOrPath)
: base(assemblyNameOrPath)
{
base.Name = Path.GetFileName(assemblyNameOrPath);
}
public TestAssembly(TestAssembly assembly, ITestFilter filter)
: base(assembly, filter)
{
base.Name = assembly.Name;
Assembly = assembly.Assembly;
}
public override TAttr[] GetCustomAttributes<TAttr>(bool inherit)
{
if ((object)Assembly == null)
return Array.Empty<TAttr>();
return Assembly.GetAttributes<TAttr>();
}
public override TestSuite Copy(ITestFilter filter)
{
return new TestAssembly(this, filter);
}
}
}