public void TearDown() { if (curveNat.IsCreated) { curveNat.Dispose(); } if (floatArray.IsCreated) { floatArray.Dispose(); } }
public void TestCanDeallocateOnJobCompletion([Values(Allocator.Persistent, Allocator.TempJob)] Allocator allocator) { curveRef = new AnimationCurve(new Keyframe(0, 0), new Keyframe(1, 1)); var toTest = new NativeCurve(curveRef, allocator); var job = new JobThatDeallocates() { Curve = toTest }.Schedule(); job.Complete(); //We expect that trying to dispose again throws an exception Assert.That(() => toTest.Dispose(), Throws.InvalidOperationException); }