Class ProtoTestAutoWrapAttribute
Opt-in low-ceremony mode: apply this attribute at assembly level and every plain [Test] in
the assembly runs inside a ProtoTest execution context, exactly like a test carrying
ProtoTestAttribute. NUnit applies the nearest IWrapSetUpTearDown attribute
(method, then fixture, then assembly), so a test that already carries ProtoTestAttribute
keeps its own wrapper and is never wrapped twice.
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
public sealed class ProtoTestAutoWrapAttribute : Attribute, IWrapSetUpTearDown, ICommandWrapper
- Inheritance
-
ProtoTestAutoWrapAttribute
- Implements
-
IWrapSetUpTearDownICommandWrapper
- Inherited Members
- Extension Methods
Examples
[assembly: ProtoTestAutoWrap]
[Test]
public async Task PlainTestsGetAContext() => Assert.That(Proto.Context, Is.Not.Null);
Methods
Wrap(TestCommand)
Wraps the test with the shared ProtoTest lifecycle command.
public TestCommand Wrap(TestCommand command)
Parameters
commandTestCommand
Returns
- TestCommand