public void HashAllSongs()
        {
            var cacheFile = Path.Combine(TestCacheDir, "TestSongsHashData.dat");
            var hasher    = new SongHasher(TestSongsDir, cacheFile);
            var newHashes = hasher.AddMissingHashes();

            Assert.AreEqual(newHashes, 6);
        }
        public void HashCacheDoesntExist()
        {
            var nonExistantCacheFile = Path.Combine(TestCacheDir, "DoesntExist.dat");
            var hasher    = new SongHasher(TestSongsDir, nonExistantCacheFile);
            var newHashes = hasher.AddMissingHashes();

            Assert.AreEqual(newHashes, 6);
        }
        public void AfterPartialCacheCoverage()
        {
            var cacheFile = Path.Combine(TestCacheDir, "TestSongsHashData_Partial.dat");
            var hasher    = new SongHasher(TestSongsDir, cacheFile);

            hasher.LoadCachedSongHashes();
            var newHashes = hasher.AddMissingHashes();

            Assert.AreEqual(newHashes, 2);
        }
        //[TestMethod]
        public void BigTest()
        {
            var hasher = new SongHasher();

            hasher.LoadCachedSongHashes();
            var songPath = new DirectoryInfo(hasher.HashDictionary.Keys.First());

            songPath = songPath.Parent;
            hasher   = new SongHasher(songPath.FullName);
            hasher.LoadCachedSongHashes();
            var newHashes = hasher.AddMissingHashes();

            Console.WriteLine($"Hashed {newHashes} new songs");
        }
        public void DirectoryDoesntExist()
        {
            var nonExistantDir = Path.Combine(TestSongsDir, "DoesntExist");

            if (Directory.Exists(nonExistantDir))
            {
                Directory.Delete(nonExistantDir, true);
            }
            Assert.IsFalse(Directory.Exists(nonExistantDir));
            var hasher = new SongHasher(nonExistantDir);

            Assert.ThrowsException <DirectoryNotFoundException>(() => hasher.AddMissingHashes());
            if (Directory.Exists(nonExistantDir))
            {
                Directory.Delete(nonExistantDir, true);
            }
        }
        public void EmptyDirectory()
        {
            var emptyDir = Path.Combine(TestSongsDir, "EmptyDirectory");
            var dInfo    = new DirectoryInfo(emptyDir);

            dInfo.Create();
            Assert.AreEqual(0, dInfo.GetFiles().Count());
            var hasher    = new SongHasher(emptyDir);
            var newHashes = hasher.AddMissingHashes();

            Assert.AreEqual(0, newHashes);

            //Clean up
            if (dInfo.Exists)
            {
                dInfo.Delete(true);
            }
        }