public void Dispose_CalledMultipleTimes_DoesNotThrow() { // Setup var configuration = new SimplePersistentCacheConfiguration("folder"); // Call void Call() { configuration.Dispose(); configuration.Dispose(); } // Assert Assert.DoesNotThrow(Call); }
public void InitializeFromTileSource_ConfigurationDisposed_ThrowObjectDisposedException() { // Setup var mocks = new MockRepository(); var tileProvider = mocks.Stub <ITileProvider>(); var tileSchema = mocks.Stub <ITileSchema>(); mocks.ReplayAll(); string rootPath = TestHelper.GetScratchPadPath("InitializeFromTileSource_ConfigurationDisposed_ThrownObjectDisposedException"); var configuration = new SimplePersistentCacheConfiguration(rootPath); configuration.Dispose(); var tileSource = new TileSource(tileProvider, tileSchema); DoAndCleanupAfter( () => { // Call void Call() => configuration.TestInitializeFromTileSource(tileSource); // Assert string objectName = Assert.Throws <ObjectDisposedException>(Call).ObjectName; Assert.AreEqual("SimplePersistentCacheConfiguration", objectName); }, rootPath); mocks.VerifyAll(); }
public void CreateTileCache_ConfigurationDisposed_ThrowObjectDisposedException() { // Setup var configuration = new SimplePersistentCacheConfiguration("path"); configuration.Dispose(); // Call void Call() => configuration.TestCreateTileCache(); // Assert string objectName = Assert.Throws <ObjectDisposedException>(Call).ObjectName; Assert.AreEqual("SimplePersistentCacheConfiguration", objectName); }