Ejemplo n.º 1
0
        private static void TestFine()
        {
            string path = VirtualDrive.VirtualFileName(@"TestAlbumExplorerProcessor\TestFine\");
            TestTags.CreateDemoTags(path, 6, n => n.Album = "Album");

            AlbumExplorerProcessor processor = new AlbumExplorerProcessor();

            bool succeded = false;
            bool failed = false;

            processor.FineCallback += delegate(AlbumExplorer.AlbumResult album)
            {
                UnitTest.Test(album.Album.Result == AlbumExplorer.ParseResult.Fine);
                UnitTest.Test(album.Album[FrameMeaning.Artist] == "Artist");
                UnitTest.Test(album.Album[FrameMeaning.Album] == "Album");
                UnitTest.Test(album.Album[FrameMeaning.ReleaseYear] == "1993");

                succeded = true;
            };
            processor.BadCallback += delegate(AlbumExplorer.AlbumResult album)
            {
                failed = true;
            };

            processor.Process(new DirectoryInfo(path));

            UnitTest.Test(succeded);
            UnitTest.Test(!failed);

            VirtualDrive.DeleteDirectory(path, true);
        }
Ejemplo n.º 2
0
        private static void TestSuccess(string path, AlbumExplorerProcessor processor)
        {
            bool succeded = false;
            bool failed = false;

            processor.FineCallback += delegate(AlbumExplorer.AlbumResult album)
            {
                succeded = true;
            };
            processor.BadCallback += delegate(AlbumExplorer.AlbumResult album)
            {
                UnitTest.Test(false);
                failed = true;
            };

            processor.Process(new DirectoryInfo(path));

            UnitTest.Test(succeded);
            UnitTest.Test(!failed);

            VirtualDrive.DeleteDirectory(path, true);
        }
Ejemplo n.º 3
0
        private static void TestFailure(string path, AlbumExplorer.ParseResult expected)
        {
            AlbumExplorerProcessor processor = new AlbumExplorerProcessor();

            bool succeded = false;
            bool failed = false;

            processor.FineCallback += delegate(AlbumExplorer.AlbumResult album)
            {
                succeded = true;
            };
            processor.BadCallback += delegate(AlbumExplorer.AlbumResult album)
            {
                UnitTest.Test(album.Album.Result == expected);
                failed = true;
            };

            processor.Process(new DirectoryInfo(path));

            UnitTest.Test(!succeded);
            UnitTest.Test(failed);

            VirtualDrive.DeleteDirectory(path, true);
        }