You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using System;
using System.Buffers;
using NUnit.Framework;
namespace Foo
{
[FixtureLifeCycle(LifeCycle.InstancePerTestCase)]
[TestFixture(256)]
[TestFixture(1024)]
[Parallelizable(scope: ParallelScope.All)]
public class FixtureTests : IDisposable
{
private byte[] _buffer;
public FixtureTests(int bufferSize) => _buffer = ArrayPool<byte>.Shared.Rent(bufferSize);
public void Dispose() => ArrayPool<byte>.Shared.Return(_buffer);
[TestCase(0)]
[TestCase(256)]
public void Foo_Test(int size)
{
Assert.AreEqual(size, size);
}
}
}
I would expect the above to create and dispose the fixture per test case but it is resulting in an exception from NUnit
Failed Foo_Test(0) [127 ms]
Error Message:
System.InvalidOperationException : DisposeFixtureCommand does not apply neither to TestMethod, nor to ParameterizedMethodSuite
Stack Trace:
at NUnit.Framework.Guard.OperationValid(Boolean condition, String message)
at NUnit.Framework.Internal.Commands.DisposeFixtureCommand..ctor(TestCommand innerCommand)
at NUnit.Framework.Internal.Execution.SimpleWorkItem.MakeTestCommand()
at NUnit.Framework.Internal.Execution.SimpleWorkItem.PerformWork()
isn't this expected to work this way?
The text was updated successfully, but these errors were encountered:
I would expect the above to create and dispose the fixture per test case but it is resulting in an exception from NUnit
isn't this expected to work this way?
The text was updated successfully, but these errors were encountered: