public void MultipleReleaseTest() { RecyclableObject obj = RecyclableObject.NewInstance(); obj.Release(); var exception = Assert.ThrowsAny <InvalidOperationException>(() => obj.Release()); Assert.True(exception != null); }
public void ReleaseTest() { RecyclableObject obj = RecyclableObject.NewInstance(); obj.Release(); RecyclableObject obj2 = RecyclableObject.NewInstance(); Assert.Same(obj, obj2); obj2.Release(); }
public void RecycleAtDifferentThreadTest() { RecyclableObject obj = RecyclableObject.NewInstance(); RecyclableObject prevObject = obj; Task.Run(() => { obj.Release(); }).Wait(); obj = RecyclableObject.NewInstance(); Assert.True(obj == prevObject); obj.Release(); }