public void Teardown()
 {
     this.actual.Dispose();
     if (Directory.Exists(DictionaryLocation))
     {
         Cleanup.DeleteDirectoryWithRetry(DictionaryLocation);
     }
 }
Ejemplo n.º 2
0
        public void TestPersistentDictionaryRandomInsertAndLookupSpeed()
        {
            using (var dictionary = new PersistentDictionary <long, string>(DictionaryLocation))
            {
                MeasureRandomInsertAndLookupSpeed(dictionary);
            }

            Cleanup.DeleteDirectoryWithRetry(DictionaryLocation);
        }
Ejemplo n.º 3
0
        public void VerifyOpenFailsOnMismatchedValueTypes()
        {
            const string DictionaryLocation = "IntIntDictionary";
            var          dict = new PersistentDictionary <int, int>(DictionaryLocation);

            dict.Dispose();
            var wrongDict = new PersistentDictionary <int, string>(DictionaryLocation);

            Cleanup.DeleteDirectoryWithRetry(DictionaryLocation);
        }
Ejemplo n.º 4
0
        public void TestPersistentDictionary()
        {
            const string Directory = "IDictionary";

            using (var dictionary = new PersistentDictionary <string, string>(Directory))
            {
                IDictionaryTest(dictionary);
            }

            Cleanup.DeleteDirectoryWithRetry(Directory);
        }
        public void Teardown()
        {
            if (this.dictionary != null)
            {
                this.dictionary.Dispose();
            }

            if (Directory.Exists(DictionaryLocation))
            {
                Cleanup.DeleteDirectoryWithRetry(DictionaryLocation);
            }
        }
Ejemplo n.º 6
0
        public void VerifyConstructorCanCopyDictionary()
        {
            const string DictionaryLocation = "CopiedDictionary";
            var          expected           = new Dictionary <int, Guid?>();

            for (int i = 0; i < 256; ++i)
            {
                expected[i] = Guid.NewGuid();
            }

            var actual = new PersistentDictionary <int, Guid?>(expected, DictionaryLocation);

            DictionaryAssert.AreEqual(expected, actual);
            actual.Dispose();
            Cleanup.DeleteDirectoryWithRetry(DictionaryLocation);
        }
Ejemplo n.º 7
0
        public void VerifyDeleteLeavesUnrelatedFiles()
        {
            const string TestDirectory = "testdirectory";
            string       testFile      = Path.Combine(TestDirectory, "myfile.log");

            if (Directory.Exists(TestDirectory))
            {
                Directory.Delete(TestDirectory);
            }

            Directory.CreateDirectory(TestDirectory);
            File.WriteAllText(testFile, "hello world");
            PersistentDictionaryFile.DeleteFiles(TestDirectory);
            Assert.IsTrue(File.Exists(testFile));
            Cleanup.DeleteDirectoryWithRetry(TestDirectory);
        }
 public void Teardown()
 {
     Cleanup.DeleteDirectoryWithRetry(DictionaryPath);
 }
Ejemplo n.º 9
0
 public void Teardown()
 {
     this.dictionary.Dispose();
     Cleanup.DeleteDirectoryWithRetry(Directory);
 }
Ejemplo n.º 10
0
 public void Setup()
 {
     Cleanup.DeleteDirectoryWithRetry(Directory);
     this.dictionary    = new PersistentDictionary <int, int>(Directory);
     this.dictionary[1] = 1;
 }
Ejemplo n.º 11
0
 public void Teardown()
 {
     Trace.Listeners.Remove(this.traceListener);
     Cleanup.DeleteDirectoryWithRetry(DictionaryLocation);
 }
 public void Setup()
 {
     Cleanup.DeleteDirectoryWithRetry(DictionaryLocation);
     CreateTestData();
     this.dictionary = new PersistentDictionary <string, string>(data, DictionaryLocation);
 }