<PackageReference Include="NUnit" Version="3.0.1" />

MaxTimeCommand

TODO: Documentation needed for class
using NUnit.Framework.Interfaces; using System.Diagnostics; namespace NUnit.Framework.Internal.Commands { public class MaxTimeCommand : DelegatingTestCommand { private int maxTime; public MaxTimeCommand(TestCommand innerCommand, int maxTime) : base(innerCommand) { this.maxTime = maxTime; } public override TestResult Execute(TestExecutionContext context) { long timestamp = Stopwatch.GetTimestamp(); TestResult testResult = innerCommand.Execute(context); double num2 = testResult.Duration = (double)(Stopwatch.GetTimestamp() - timestamp) / (double)Stopwatch.Frequency; if (testResult.ResultState == ResultState.Success) { double num3 = testResult.Duration * 1000; if (num3 > (double)maxTime) testResult.SetResult(ResultState.Failure, $"""{num3}""{maxTime}"""); } return testResult; } } }