public void Dispose_CalledTwice_CallsSyncHooksOnlyOnce() { // Arrange var resource = new DisposableResourceSpy(); // Act resource.Dispose(); resource.Dispose(); // Assert Assert.AreEqual(1, resource.ReleaseManagedResourcesCallCount); Assert.AreEqual(1, resource.ReleaseNativeResourcesCallCount); Assert.AreEqual(0, resource.ReleaseManagedResourcesAsyncCallCount); }
public void Dispose_ByDefault_Disposes() { // Arrange var resource = new DisposableResourceSpy(); // Act resource.Dispose(); // Assert Assert.IsTrue(resource.IsDisposed); }
public void Dispose_ByDefault_CallsAllSyncHooks() { // Arrange var resource = new DisposableResourceSpy(); // Act resource.Dispose(); // Assert Assert.AreEqual(1, resource.ReleaseManagedResourcesCallCount); Assert.AreEqual(1, resource.ReleaseNativeResourcesCallCount); Assert.AreEqual(0, resource.ReleaseManagedResourcesAsyncCallCount); }