Exemplo n.º 1
0
        public void ImportTestCalculateEndCorrectly()
        {
            var testHelper     = new TestHelper();
            var textImportFile = new TextImportFile(new MemoryStream(Resources.Textimport_Bug_54));

            textImportFile.TextImportScheme.SchemeTracks   = "%Artist% - %Title%[\t]{1,}%End%";
            textImportFile.TextImportScheme.SchemeCuesheet = String.Empty;
            Assert.IsNull(textImportFile.AnalyseException);
            Assert.IsTrue(textImportFile.ImportCuesheet.Tracks.Count == 39);
            Assert.IsTrue(textImportFile.IsValid);
            var cuesheet = new Cuesheet();

            cuesheet.Import(textImportFile, testHelper.ApplicationOptions);
            Assert.IsTrue(cuesheet.Tracks.Count == 39);
            Assert.IsTrue(cuesheet.Tracks.ElementAt(0).End == new TimeSpan(0, 5, 24));
            Assert.IsTrue(cuesheet.Tracks.ElementAt(38).Begin == new TimeSpan(3, 13, 13));
        }
Exemplo n.º 2
0
        public void ImportTest()
        {
            //Prepare text input file
            StringBuilder builder = new StringBuilder();

            builder.AppendLine("CuesheetArtist - CuesheetTitle				c:\\tmp\\Testfile.mp3");
            builder.AppendLine("Sample Artist 1 - Sample Title 1				00:05:00");
            builder.AppendLine("Sample Artist 2 - Sample Title 2				00:09:23");
            builder.AppendLine("Sample Artist 3 - Sample Title 3				00:15:54");
            builder.AppendLine("Sample Artist 4 - Sample Title 4				00:20:13");
            builder.AppendLine("Sample Artist 5 - Sample Title 5				00:24:54");
            builder.AppendLine("Sample Artist 6 - Sample Title 6				00:31:54");
            builder.AppendLine("Sample Artist 7 - Sample Title 7				00:45:54");
            builder.AppendLine("Sample Artist 8 - Sample Title 8				01:15:54");

            var tempFile = Path.GetTempFileName();

            File.WriteAllText(tempFile, builder.ToString());

            //Test TextImportFile
            var textImportFile = new TextImportFile(new MemoryStream(File.ReadAllBytes(tempFile)));

            textImportFile.TextImportScheme.SchemeTracks   = "%Artist% - %Title%[\t]{1,}%End%";
            textImportFile.TextImportScheme.SchemeCuesheet = "\\A.*%Cuesheet.Artist% - %Cuesheet.Title%[\t]{1,}%Cuesheet.Audiofile%";
            Assert.IsNull(textImportFile.AnalyseException);
            Assert.IsTrue(textImportFile.ImportCuesheet.Tracks.Count == 8);
            Assert.IsTrue(textImportFile.IsValid);

            var testHelper = new TestHelper();
            var cuesheet   = new Cuesheet();

            cuesheet.Import(textImportFile, testHelper.ApplicationOptions);

            Assert.IsNull(cuesheet.CDTextfile);
            Assert.AreEqual(2, cuesheet.ValidationErrors.Count);

            File.Delete(tempFile);
        }