// // You can use the following additional attributes as you write your tests: // // Use ClassInitialize to run code before running the first test in the class // [ClassInitialize()] // public static void MyClassInitialize(TestContext testContext) { } // // Use ClassCleanup to run code after all tests in a class have run // [ClassCleanup()] // public static void MyClassCleanup() { } // // Use TestInitialize to run code before running each test // [TestInitialize()] // public void MyTestInitialize() { } // // Use TestCleanup to run code after each test has run // [TestCleanup()] // public void MyTestCleanup() { } // #endregion private IPersistentCollectionSpaceManager InitPAFS(string arrayName, int elementSize, int uHeaderSize) { PersistentCollectionSpaceManager pcsm; try { pcsm = new PersistentCollectionSpaceManager(arrayName, elementSize, uHeaderSize); } catch (FileNameConflictException) { pcsm = new PersistentCollectionSpaceManager(arrayName); pcsm.Delete(); pcsm = new PersistentCollectionSpaceManager(arrayName, elementSize, uHeaderSize); } return(pcsm); }
public void CreateTooSmallTest() { PersistentCollectionSpaceManager pcsm = null; try { pcsm = new PersistentCollectionSpaceManager("PCSMCreateTooSmall", 3, 3); Assert.Fail("Should throw an exception"); } catch (InvalidElementSizeException) { if (pcsm != null) { pcsm.Delete(); } } }
public void CreateTest() { //prime the pump string arrayName = "arrayName"; PersistentCollectionSpaceManager pcsm = (PersistentCollectionSpaceManager)InitPAFS(arrayName, 16, 4); pcsm.Delete(); pcsm = null; PersistentCollectionSpaceManager pcsm2 = new PersistentCollectionSpaceManager(arrayName, 16, 4); try { pcsm = new PersistentCollectionSpaceManager(arrayName, 16, 4); Assert.Fail("Should throw an exception"); }catch (FileNameConflictException) { if (pcsm != null) { pcsm.Delete(); } } }