- @if (Cuesheet?.GetSplitPointAtTrack(track) != null)
+ @if (Cuesheet?.GetSectionAtTrack(track) != null)
{
@@ -768,8 +768,8 @@ along with Foobar. If not, see
{
if (Cuesheet != null)
{
- Cuesheet.SplitPointAdded += Cuesheet_SplitPointAdded;
- Cuesheet.SplitPointRemoved += Cuesheet_SplitPointRemoved;
+ Cuesheet.SectionAdded += Cuesheet_SectionAdded;
+ Cuesheet.SectionRemoved += Cuesheet_SectionRemoved;
}
}
@@ -777,26 +777,27 @@ along with Foobar. If not, see
{
if (Cuesheet != null)
{
- Cuesheet.SplitPointAdded -= Cuesheet_SplitPointAdded;
- Cuesheet.SplitPointRemoved -= Cuesheet_SplitPointRemoved;
+ Cuesheet.SectionAdded -= Cuesheet_SectionAdded;
+ Cuesheet.SectionRemoved -= Cuesheet_SectionRemoved;
}
}
- void Cuesheet_SplitPointAdded(object? sender, SplitPointAddRemoveEventArgs args)
+ void Cuesheet_SectionAdded(object? sender, CuesheetSectionAddRemoveEventArgs args)
{
- args.SplitPoint.ValidateablePropertyChanged += SplitPoint_ValidateablePropertyChanged;
+ args.Section.ValidateablePropertyChanged += Section_ValidateablePropertyChanged;
}
- void Cuesheet_SplitPointRemoved(object? sender, SplitPointAddRemoveEventArgs args)
+ void Cuesheet_SectionRemoved(object? sender, CuesheetSectionAddRemoveEventArgs args)
{
- args.SplitPoint.ValidateablePropertyChanged -= SplitPoint_ValidateablePropertyChanged;
+ args.Section.ValidateablePropertyChanged -= Section_ValidateablePropertyChanged;
}
- void SplitPoint_ValidateablePropertyChanged(object? sender, string property)
+ void Section_ValidateablePropertyChanged(object? sender, string property)
{
switch (property)
{
- case nameof(SplitPoint.Moment):
+ case nameof(CuesheetSection.Begin):
+ case nameof(CuesheetSection.End):
StateHasChanged();
break;
}
diff --git a/AudioCuesheetEditorTests/Model/AudioCuesheet/CuesheetTests.cs b/AudioCuesheetEditorTests/Model/AudioCuesheet/CuesheetTests.cs
index 8eb7f310..115a2395 100644
--- a/AudioCuesheetEditorTests/Model/AudioCuesheet/CuesheetTests.cs
+++ b/AudioCuesheetEditorTests/Model/AudioCuesheet/CuesheetTests.cs
@@ -604,19 +604,5 @@ public void ValidateTest()
cuesheet.Title = "Testtitle";
Assert.AreEqual(ValidationStatus.Success, cuesheet.Validate(x => x.Title).Status);
}
-
- [TestMethod()]
- public void ImportProjectfileTest()
- {
- var fileContent = Encoding.UTF8.GetBytes("{\"Tracks\":[{\"Position\":1,\"Artist\":\"Artist 1\",\"Title\":\"Title 1\",\"Begin\":\"00:00:00\",\"End\":\"00:01:01\",\"Flags\":[\"4CH\"],\"IsLinkedToPreviousTrack\":true},{\"Position\":2,\"Artist\":\"Artist 2\",\"Title\":\"Title 2\",\"Begin\":\"00:01:01\",\"End\":\"00:03:03\",\"Flags\":[\"4CH\"],\"IsLinkedToPreviousTrack\":true},{\"Position\":3,\"Artist\":\"Artist 3\",\"Title\":\"Title 3\",\"Begin\":\"00:03:03\",\"End\":\"00:06:06\",\"Flags\":[\"4CH\"],\"IsLinkedToPreviousTrack\":true},{\"Position\":4,\"Artist\":\"Artist 4\",\"Title\":\"Title 4\",\"Begin\":\"00:06:06\",\"End\":\"00:10:10\",\"Flags\":[\"4CH\",\"DCP\"],\"IsLinkedToPreviousTrack\":true},{\"Position\":5,\"Artist\":\"Artist 5\",\"Title\":\"Title 5\",\"Begin\":\"00:10:10\",\"End\":\"00:15:15\",\"Flags\":[\"4CH\"],\"IsLinkedToPreviousTrack\":true},{\"Position\":6,\"Artist\":\"Artist 6\",\"Title\":\"Title 6\",\"Begin\":\"00:15:15\",\"End\":\"00:21:21\",\"Flags\":[\"4CH\"],\"IsLinkedToPreviousTrack\":true},{\"Position\":7,\"Artist\":\"Artist 7\",\"Title\":\"Title 7\",\"Begin\":\"00:21:21\",\"End\":\"00:28:28\",\"Flags\":[\"4CH\"],\"IsLinkedToPreviousTrack\":true},{\"Position\":8,\"Artist\":\"Artist 8\",\"Title\":\"Title 8\",\"Begin\":\"00:28:28\",\"End\":\"00:36:36\",\"Flags\":[\"4CH\",\"DCP\"],\"IsLinkedToPreviousTrack\":true},{\"Position\":9,\"Artist\":\"Artist 9\",\"Title\":\"Title 9\",\"Begin\":\"00:36:36\",\"End\":\"00:45:45\",\"Flags\":[\"4CH\"],\"IsLinkedToPreviousTrack\":true},{\"Position\":10,\"Artist\":\"Artist 10\",\"Title\":\"Title 10\",\"Begin\":\"00:45:45\",\"End\":\"00:55:55\",\"Flags\":[\"4CH\",\"DCP\"],\"IsLinkedToPreviousTrack\":true}],\"Artist\":\"CuesheetArtist\",\"Title\":\"CuesheetTitle\",\"Audiofile\":{\"Name\":\"AudioFile.mp3\"},\"CDTextfile\":{\"Name\":\"CDTextfile.cdt\"},\"Cataloguenumber\":{\"Value\":\"A123\"},\"SplitPoints\":[{\"Artist\":\"CuesheetArtist\",\"Title\":\"CuesheetTitle\",\"Moment\":\"00:30:00\"},{\"Artist\":\"CuesheetArtist\",\"Title\":\"CuesheetTitle\",\"Moment\":\"01:00:00\"}]}");
- var projectFileCuesheet = Projectfile.ImportFile(fileContent);
- Assert.IsNotNull(projectFileCuesheet);
- Assert.AreEqual(2, projectFileCuesheet.SplitPoints.Count);
- var cuesheet = new Cuesheet();
- var testHelper = new TestHelper();
- cuesheet.Import(projectFileCuesheet, testHelper.ApplicationOptions);
- Assert.AreEqual(2, cuesheet.SplitPoints.Count);
- Assert.IsTrue(cuesheet.SplitPoints.All(x => x.Cuesheet == cuesheet));
- }
}
}
\ No newline at end of file
diff --git a/AudioCuesheetEditorTests/Model/IO/Export/CuesheetSectionTests.cs b/AudioCuesheetEditorTests/Model/IO/Export/CuesheetSectionTests.cs
new file mode 100644
index 00000000..e9810a3c
--- /dev/null
+++ b/AudioCuesheetEditorTests/Model/IO/Export/CuesheetSectionTests.cs
@@ -0,0 +1,56 @@
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using AudioCuesheetEditor.Model.IO.Export;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using AudioCuesheetEditor.Model.Entity;
+using AudioCuesheetEditor.Model.AudioCuesheet;
+
+namespace AudioCuesheetEditor.Model.IO.Export.Tests
+{
+ [TestClass()]
+ public class CuesheetSectionTests
+ {
+ [TestMethod()]
+ public void ValidationTest()
+ {
+ var cuesheet = new Cuesheet();
+ var section = new CuesheetSection(cuesheet);
+ Assert.IsNull(section.Begin);
+ var beginValidationResult = section.Validate(x => x.Begin);
+ var endValidationResult = section.Validate(x => x.End);
+ Assert.AreEqual(ValidationStatus.Error, beginValidationResult.Status);
+ Assert.AreEqual(ValidationStatus.Error, endValidationResult.Status);
+ section.Begin = new TimeSpan(0, 0, 0);
+ beginValidationResult = section.Validate(x => x.Begin);
+ endValidationResult = section.Validate(x => x.End);
+ Assert.AreEqual(ValidationStatus.Success, beginValidationResult.Status);
+ Assert.AreEqual(ValidationStatus.Error, endValidationResult.Status);
+ cuesheet.AddTrack(new Track() { Position = 1, Begin = new TimeSpan(0, 0, 10) });
+ cuesheet.AddTrack(new Track() { Position = 2, Begin = new TimeSpan(0, 8, 43), End = new TimeSpan(0, 15, 43) });
+ beginValidationResult = section.Validate(x => x.Begin);
+ endValidationResult = section.Validate(x => x.End);
+ Assert.AreEqual(ValidationStatus.Error, beginValidationResult.Status);
+ Assert.AreEqual(ValidationStatus.Error, endValidationResult.Status);
+ section.Begin = new TimeSpan(0, 0, 10);
+ beginValidationResult = section.Validate(x => x.Begin);
+ endValidationResult = section.Validate(x => x.End);
+ Assert.AreEqual(ValidationStatus.Success, beginValidationResult.Status);
+ Assert.AreEqual(ValidationStatus.Error, endValidationResult.Status);
+ section.Begin = new TimeSpan(0, 10, 0);
+ section.End = new TimeSpan(0, 5, 0);
+ beginValidationResult = section.Validate(x => x.Begin);
+ endValidationResult = section.Validate(x => x.End);
+ Assert.AreEqual(ValidationStatus.Error, beginValidationResult.Status);
+ Assert.AreEqual(ValidationStatus.Error, endValidationResult.Status);
+ section.Begin = new TimeSpan(0, 10, 0);
+ section.End = new TimeSpan(0, 15, 0);
+ beginValidationResult = section.Validate(x => x.Begin);
+ endValidationResult = section.Validate(x => x.End);
+ Assert.AreEqual(ValidationStatus.Success, beginValidationResult.Status);
+ Assert.AreEqual(ValidationStatus.Success, endValidationResult.Status);
+ }
+ }
+}
\ No newline at end of file
diff --git a/AudioCuesheetEditorTests/Model/IO/Export/ExportfileGeneratorTests.cs b/AudioCuesheetEditorTests/Model/IO/Export/ExportfileGeneratorTests.cs
index a06551f6..97653e63 100644
--- a/AudioCuesheetEditorTests/Model/IO/Export/ExportfileGeneratorTests.cs
+++ b/AudioCuesheetEditorTests/Model/IO/Export/ExportfileGeneratorTests.cs
@@ -280,7 +280,7 @@ public void GenerateCuesheetFilesWithIncorrectTrackPositionsTest()
}
[TestMethod()]
- public void GenerateCuesheetFilesWithSplitPointsTest()
+ public void GenerateCuesheetFilesWithSectionsTest()
{
var testHelper = new TestHelper();
Cuesheet cuesheet = new()
@@ -302,39 +302,40 @@ public void GenerateCuesheetFilesWithSplitPointsTest()
track.End = begin;
cuesheet.AddTrack(track, testHelper.ApplicationOptions);
}
- var splitPoint = cuesheet.AddSplitPoint();
- splitPoint.Moment = new TimeSpan(2, 0, 0);
- splitPoint.Title = "Last part";
- splitPoint.AudiofileName = "Last part.mp3";
- splitPoint = cuesheet.AddSplitPoint();
- splitPoint.Moment = new TimeSpan(0, 30, 0);
- splitPoint.AudiofileName = "First part.mp3";
- splitPoint = cuesheet.AddSplitPoint();
- splitPoint.Moment = new TimeSpan(1, 0, 0);
- splitPoint.Artist = "Demo Artist Part2";
- splitPoint = cuesheet.AddSplitPoint();
- splitPoint.Artist = "Artist 3";
- splitPoint.Title = "Title 3";
- splitPoint.AudiofileName = "Part 3.mp3";
- splitPoint.Moment = new TimeSpan(1, 30, 0);
+ var section = cuesheet.AddSection();
+ section.Begin = new TimeSpan(1, 30, 0);
+ section.End = new TimeSpan(2, 0, 0);
+ section.Title = "Last part";
+ section.AudiofileName = "Last part.mp3";
+ section = cuesheet.AddSection();
+ section.Begin = new TimeSpan(0, 0, 0);
+ section.End = new TimeSpan(0, 30, 0);
+ section.AudiofileName = "First part.mp3";
+ section = cuesheet.AddSection();
+ section.Begin = new TimeSpan(0, 30, 0);
+ section.End = new TimeSpan(1, 0, 0);
+ section.Artist = "Demo Artist Part2";
+ section = cuesheet.AddSection();
+ section.Artist = "Artist 3";
+ section.Title = "Title 3";
+ section.AudiofileName = "Part 3.mp3";
+ section.Begin = new TimeSpan(1, 0, 0);
+ section.End = new TimeSpan(1, 30, 0);
testHelper.ApplicationOptions.CuesheetFilename = "Unit test.cue";
var generator = new ExportfileGenerator(ExportType.Cuesheet, cuesheet, applicationOptions: testHelper.ApplicationOptions);
Assert.AreEqual(ValidationStatus.Success, generator.Validate().Status);
var generatedFiles = generator.GenerateExportfiles();
- Assert.AreEqual(5, generatedFiles.Count);
+ Assert.AreEqual(4, generatedFiles.Count);
var position = 1;
var counter = 1;
- //Check split according to split points
- Assert.AreEqual(cuesheet.Tracks.Min(x => x.Begin), generatedFiles.First().Begin);
+ //Check split according to sections
+ Assert.AreEqual(new TimeSpan(0, 0, 0), generatedFiles.First().Begin);
Assert.AreEqual(new TimeSpan(0, 30, 0), generatedFiles.First().End);
- Assert.AreEqual(new TimeSpan(0, 30, 0), generatedFiles.ElementAt(1).Begin);
Assert.AreEqual(new TimeSpan(1, 0, 0), generatedFiles.ElementAt(1).End);
Assert.AreEqual(new TimeSpan(1, 0, 0), generatedFiles.ElementAt(2).Begin);
Assert.AreEqual(new TimeSpan(1, 30, 0), generatedFiles.ElementAt(2).End);
- Assert.AreEqual(new TimeSpan(1, 30, 0), generatedFiles.ElementAt(3).Begin);
- Assert.AreEqual(new TimeSpan(2, 0, 0), generatedFiles.ElementAt(3).End);
- Assert.AreEqual(new TimeSpan(2, 0, 0), generatedFiles.ElementAt(4).Begin);
- Assert.AreEqual(cuesheet.Tracks.Max(x => x.End), generatedFiles.Last().End);
+ Assert.AreEqual(new TimeSpan(1, 30, 0), generatedFiles.Last().Begin);
+ Assert.AreEqual(new TimeSpan(2, 0, 0), generatedFiles.Last().End);
foreach (var generatedFile in generatedFiles)
{
Assert.AreEqual(String.Format("Unit test({0}).cue", counter), generatedFile.Name);
@@ -346,13 +347,13 @@ public void GenerateCuesheetFilesWithSplitPointsTest()
var fileContent = File.ReadAllLines(fileName);
File.Delete(fileName);
int positionDifference = 1 - position;
- // Check cuesheet header for splitpoint artist and title
- var splitPointForThisFile = cuesheet.SplitPoints.FirstOrDefault(x => x.Moment == generatedFile.End);
- if (splitPointForThisFile != null)
+ // Check cuesheet header for artist and title
+ var sectionForThisFile = cuesheet.Sections.FirstOrDefault(x => x.Begin == generatedFile.Begin);
+ if (sectionForThisFile != null)
{
- Assert.AreEqual(String.Format("{0} \"{1}\"", CuesheetConstants.CuesheetTitle, splitPointForThisFile.Title), fileContent.First());
- Assert.AreEqual(String.Format("{0} \"{1}\"", CuesheetConstants.CuesheetArtist, splitPointForThisFile.Artist), fileContent[1]);
- Assert.AreEqual(String.Format("{0} \"{1}\" {2}", CuesheetConstants.CuesheetFileName, splitPointForThisFile.AudiofileName, cuesheet.Audiofile?.AudioFileType), fileContent[2]);
+ Assert.AreEqual(String.Format("{0} \"{1}\"", CuesheetConstants.CuesheetTitle, sectionForThisFile.Title), fileContent.First());
+ Assert.AreEqual(String.Format("{0} \"{1}\"", CuesheetConstants.CuesheetArtist, sectionForThisFile.Artist), fileContent[1]);
+ Assert.AreEqual(String.Format("{0} \"{1}\" {2}", CuesheetConstants.CuesheetFileName, sectionForThisFile.AudiofileName, cuesheet.Audiofile?.AudioFileType), fileContent[2]);
}
else
{
@@ -592,7 +593,7 @@ public void GenerateExportfilesWithPregapAndPostgapTest()
}
[TestMethod()]
- public void GenerateExportfilesWithSplitPointsTest()
+ public void GenerateExportfilesWithSectionsTest()
{
var testHelper = new TestHelper();
//Prepare cuesheet
@@ -627,21 +628,25 @@ public void GenerateExportfilesWithSplitPointsTest()
cuesheet.Cataloguenumber.Value = "0123456789123";
cuesheet.CDTextfile = new CDTextfile("Testfile.cdt");
- var splitPoint = cuesheet.AddSplitPoint();
- splitPoint.Moment = new TimeSpan(2, 0, 0);
- splitPoint.Title = "Last part";
- splitPoint.AudiofileName = "Last part.mp3";
- splitPoint = cuesheet.AddSplitPoint();
- splitPoint.Moment = new TimeSpan(0, 30, 0);
- splitPoint.AudiofileName = "First part.mp3";
- splitPoint = cuesheet.AddSplitPoint();
- splitPoint.Moment = new TimeSpan(1, 0, 0);
- splitPoint.Artist = "Demo Artist Part2";
- splitPoint = cuesheet.AddSplitPoint();
- splitPoint.Artist = "Artist 3";
- splitPoint.Title = "Title 3";
- splitPoint.AudiofileName = "Part 3.mp3";
- splitPoint.Moment = new TimeSpan(1, 30, 0);
+ var section = cuesheet.AddSection();
+ section.Begin = new TimeSpan(1, 30, 0);
+ section.End = new TimeSpan(2, 0, 0);
+ section.Title = "Last part";
+ section.AudiofileName = "Last part.mp3";
+ section = cuesheet.AddSection();
+ section.Begin = new TimeSpan(0, 0, 0);
+ section.End = new TimeSpan(0, 30, 0);
+ section.AudiofileName = "First part.mp3";
+ section = cuesheet.AddSection();
+ section.Begin = new TimeSpan(0, 30, 0);
+ section.End = new TimeSpan(1, 0, 0);
+ section.Artist = "Demo Artist Part2";
+ section = cuesheet.AddSection();
+ section.Artist = "Artist 3";
+ section.Title = "Title 3";
+ section.AudiofileName = "Part 3.mp3";
+ section.Begin = new TimeSpan(1, 0, 0);
+ section.End = new TimeSpan(1, 30, 0);
//Test export
var exportProfile = new Exportprofile
{
@@ -652,19 +657,16 @@ public void GenerateExportfilesWithSplitPointsTest()
var generator = new ExportfileGenerator(ExportType.Exportprofile, cuesheet, exportProfile);
Assert.AreEqual(ValidationStatus.Success, generator.Validate().Status);
var generatedFiles = generator.GenerateExportfiles();
- Assert.AreEqual(5, generatedFiles.Count);
+ Assert.AreEqual(4, generatedFiles.Count);
- //Check split according to split points
- Assert.AreEqual(cuesheet.Tracks.Min(x => x.Begin), generatedFiles.First().Begin);
+ //Check split according to sections
+ Assert.AreEqual(new TimeSpan(0, 0, 0), generatedFiles.First().Begin);
Assert.AreEqual(new TimeSpan(0, 30, 0), generatedFiles.First().End);
- Assert.AreEqual(new TimeSpan(0, 30, 0), generatedFiles.ElementAt(1).Begin);
Assert.AreEqual(new TimeSpan(1, 0, 0), generatedFiles.ElementAt(1).End);
Assert.AreEqual(new TimeSpan(1, 0, 0), generatedFiles.ElementAt(2).Begin);
Assert.AreEqual(new TimeSpan(1, 30, 0), generatedFiles.ElementAt(2).End);
- Assert.AreEqual(new TimeSpan(1, 30, 0), generatedFiles.ElementAt(3).Begin);
- Assert.AreEqual(new TimeSpan(2, 0, 0), generatedFiles.ElementAt(3).End);
- Assert.AreEqual(new TimeSpan(2, 0, 0), generatedFiles.ElementAt(4).Begin);
- Assert.AreEqual(cuesheet.Tracks.Max(x => x.End), generatedFiles.Last().End);
+ Assert.AreEqual(new TimeSpan(1, 30, 0), generatedFiles.Last().Begin);
+ Assert.AreEqual(new TimeSpan(2, 0, 0), generatedFiles.Last().End);
var counter = 1;
var position = 1;
foreach (var generatedFile in generatedFiles)
@@ -678,11 +680,11 @@ public void GenerateExportfilesWithSplitPointsTest()
var fileContent = File.ReadAllLines(fileName);
File.Delete(fileName);
int positionDifference = 1 - position;
- //Check cuesheet header for splitpoint artist and title
- var splitPointForThisFile = cuesheet.SplitPoints.FirstOrDefault(x => x.Moment == generatedFile.End);
- if (splitPointForThisFile != null)
+ //Check cuesheet header for artist and title
+ var sectionForThisFile = cuesheet.Sections.FirstOrDefault(x => x.Begin == generatedFile.Begin);
+ if (sectionForThisFile != null)
{
- Assert.AreEqual(String.Format("{0};{1};{2};0123456789123;Testfile.cdt", splitPointForThisFile.Artist, splitPointForThisFile.Title, splitPointForThisFile.AudiofileName), fileContent[0]);
+ Assert.AreEqual(String.Format("{0};{1};{2};0123456789123;Testfile.cdt", sectionForThisFile.Artist, sectionForThisFile.Title, sectionForThisFile.AudiofileName), fileContent[0]);
}
else
{
@@ -710,9 +712,9 @@ public void GenerateExportfilesWithSplitPointsTest()
}
Assert.AreEqual(String.Format("{0};{1};{2};{3};{4};{5}", track.Position + positionDifference, track.Artist, track.Title, trackBegin, trackEnd, trackEnd - trackBegin), fileContent[i]);
}
- if (splitPointForThisFile != null)
+ if (sectionForThisFile != null)
{
- Assert.AreEqual(String.Format("Exported {0} from {1} using AudioCuesheetEditor", splitPointForThisFile.Title, splitPointForThisFile.Artist), fileContent.Last());
+ Assert.AreEqual(String.Format("Exported {0} from {1} using AudioCuesheetEditor", sectionForThisFile.Title, sectionForThisFile.Artist), fileContent.Last());
}
else
{
diff --git a/AudioCuesheetEditorTests/Model/IO/Export/SplitPointTests.cs b/AudioCuesheetEditorTests/Model/IO/Export/SplitPointTests.cs
deleted file mode 100644
index d4dc78e2..00000000
--- a/AudioCuesheetEditorTests/Model/IO/Export/SplitPointTests.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using AudioCuesheetEditor.Model.IO.Export;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using AudioCuesheetEditor.Model.Entity;
-using AudioCuesheetEditor.Model.AudioCuesheet;
-
-namespace AudioCuesheetEditor.Model.IO.Export.Tests
-{
- [TestClass()]
- public class SplitPointTests
- {
- [TestMethod()]
- public void ValidationTest()
- {
- var cuesheet = new Cuesheet();
- var splitPoint = new SplitPoint(cuesheet);
- Assert.IsNull(splitPoint.Moment);
- var validationResult = splitPoint.Validate(x => x.Moment);
- Assert.AreEqual(ValidationStatus.Error, validationResult.Status);
- splitPoint.Moment = new TimeSpan(0, 30, 0);
- validationResult = splitPoint.Validate(x => x.Moment);
- Assert.AreEqual(ValidationStatus.Success, validationResult.Status);
- cuesheet.AddTrack(new Track() { Position = 1});
- cuesheet.AddTrack(new Track() { Position = 2, Begin = new TimeSpan(0, 8, 43), End = new TimeSpan(0, 15, 43) });
- validationResult = splitPoint.Validate(x => x.Moment);
- Assert.AreEqual(ValidationStatus.Error, validationResult.Status);
- splitPoint.Moment = new TimeSpan(0, 15, 43);
- validationResult = splitPoint.Validate(x => x.Moment);
- Assert.AreEqual(ValidationStatus.Success, validationResult.Status);
- }
- }
-}
\ No newline at end of file
diff --git a/AudioCuesheetEditorTests/Model/IO/ProjectfileTests.cs b/AudioCuesheetEditorTests/Model/IO/ProjectfileTests.cs
index 022cec94..1f8fde61 100644
--- a/AudioCuesheetEditorTests/Model/IO/ProjectfileTests.cs
+++ b/AudioCuesheetEditorTests/Model/IO/ProjectfileTests.cs
@@ -70,7 +70,7 @@ public void GenerateFileTest()
}
[TestMethod()]
- public void GenerateFileWithSplitPointsTest()
+ public void GenerateFileWithSectionsTest()
{
var cuesheet = new Cuesheet
{
@@ -100,10 +100,10 @@ public void GenerateFileWithSplitPointsTest()
track.End = begin;
cuesheet.AddTrack(track, new Options.ApplicationOptions() { LinkTracksWithPreviousOne = true });
}
- var splitPoint = cuesheet.AddSplitPoint();
- splitPoint.Moment = new TimeSpan(0, 30, 0);
- splitPoint = cuesheet.AddSplitPoint();
- splitPoint.Moment = new TimeSpan(1, 0, 0);
+ var section = cuesheet.AddSection();
+ section.Begin = new TimeSpan(0, 30, 0);
+ section = cuesheet.AddSection();
+ section.Begin = new TimeSpan(1, 0, 0);
var projectFile = new Projectfile(cuesheet);
var generatedFile = projectFile.GenerateFile();
Assert.IsNotNull(generatedFile);
@@ -139,9 +139,9 @@ public void ImportFileTest()
}
[TestMethod()]
- public void ImportFileWithSplitPointsTest()
+ public void ImportFileWithSectionsTest()
{
- var fileContent = Encoding.UTF8.GetBytes("{\"Tracks\":[{\"Position\":1,\"Artist\":\"Artist 1\",\"Title\":\"Title 1\",\"Begin\":\"00:00:00\",\"End\":\"00:01:01\",\"Flags\":[\"4CH\"],\"IsLinkedToPreviousTrack\":true},{\"Position\":2,\"Artist\":\"Artist 2\",\"Title\":\"Title 2\",\"Begin\":\"00:01:01\",\"End\":\"00:03:03\",\"Flags\":[\"4CH\"],\"IsLinkedToPreviousTrack\":true},{\"Position\":3,\"Artist\":\"Artist 3\",\"Title\":\"Title 3\",\"Begin\":\"00:03:03\",\"End\":\"00:06:06\",\"Flags\":[\"4CH\"],\"IsLinkedToPreviousTrack\":true},{\"Position\":4,\"Artist\":\"Artist 4\",\"Title\":\"Title 4\",\"Begin\":\"00:06:06\",\"End\":\"00:10:10\",\"Flags\":[\"4CH\",\"DCP\"],\"IsLinkedToPreviousTrack\":true},{\"Position\":5,\"Artist\":\"Artist 5\",\"Title\":\"Title 5\",\"Begin\":\"00:10:10\",\"End\":\"00:15:15\",\"Flags\":[\"4CH\"],\"IsLinkedToPreviousTrack\":true},{\"Position\":6,\"Artist\":\"Artist 6\",\"Title\":\"Title 6\",\"Begin\":\"00:15:15\",\"End\":\"00:21:21\",\"Flags\":[\"4CH\"],\"IsLinkedToPreviousTrack\":true},{\"Position\":7,\"Artist\":\"Artist 7\",\"Title\":\"Title 7\",\"Begin\":\"00:21:21\",\"End\":\"00:28:28\",\"Flags\":[\"4CH\"],\"IsLinkedToPreviousTrack\":true},{\"Position\":8,\"Artist\":\"Artist 8\",\"Title\":\"Title 8\",\"Begin\":\"00:28:28\",\"End\":\"00:36:36\",\"Flags\":[\"4CH\",\"DCP\"],\"IsLinkedToPreviousTrack\":true},{\"Position\":9,\"Artist\":\"Artist 9\",\"Title\":\"Title 9\",\"Begin\":\"00:36:36\",\"End\":\"00:45:45\",\"Flags\":[\"4CH\"],\"IsLinkedToPreviousTrack\":true},{\"Position\":10,\"Artist\":\"Artist 10\",\"Title\":\"Title 10\",\"Begin\":\"00:45:45\",\"End\":\"00:55:55\",\"Flags\":[\"4CH\",\"DCP\"],\"IsLinkedToPreviousTrack\":true}],\"Artist\":\"CuesheetArtist\",\"Title\":\"CuesheetTitle\",\"Audiofile\":{\"Name\":\"AudioFile.mp3\"},\"CDTextfile\":{\"Name\":\"CDTextfile.cdt\"},\"Cataloguenumber\":{\"Value\":\"A123\"},\"SplitPoints\":[{\"Artist\":\"CuesheetArtist\",\"Title\":\"CuesheetTitle\",\"Moment\":\"00:30:00\"},{\"Artist\":\"CuesheetArtist\",\"Title\":\"CuesheetTitle\",\"Moment\":\"01:00:00\"}]}");
+ var fileContent = Encoding.UTF8.GetBytes("{\"Tracks\":[{\"Position\":1,\"Artist\":\"Artist 1\",\"Title\":\"Title 1\",\"Begin\":\"00:00:00\",\"End\":\"00:01:01\",\"Flags\":[\"4CH\"],\"IsLinkedToPreviousTrack\":true},{\"Position\":2,\"Artist\":\"Artist 2\",\"Title\":\"Title 2\",\"Begin\":\"00:01:01\",\"End\":\"00:03:03\",\"Flags\":[\"4CH\"],\"IsLinkedToPreviousTrack\":true},{\"Position\":3,\"Artist\":\"Artist 3\",\"Title\":\"Title 3\",\"Begin\":\"00:03:03\",\"End\":\"00:06:06\",\"Flags\":[\"4CH\"],\"IsLinkedToPreviousTrack\":true},{\"Position\":4,\"Artist\":\"Artist 4\",\"Title\":\"Title 4\",\"Begin\":\"00:06:06\",\"End\":\"00:10:10\",\"Flags\":[\"4CH\",\"DCP\"],\"IsLinkedToPreviousTrack\":true},{\"Position\":5,\"Artist\":\"Artist 5\",\"Title\":\"Title 5\",\"Begin\":\"00:10:10\",\"End\":\"00:15:15\",\"Flags\":[\"4CH\"],\"IsLinkedToPreviousTrack\":true},{\"Position\":6,\"Artist\":\"Artist 6\",\"Title\":\"Title 6\",\"Begin\":\"00:15:15\",\"End\":\"00:21:21\",\"Flags\":[\"4CH\"],\"IsLinkedToPreviousTrack\":true},{\"Position\":7,\"Artist\":\"Artist 7\",\"Title\":\"Title 7\",\"Begin\":\"00:21:21\",\"End\":\"00:28:28\",\"Flags\":[\"4CH\"],\"IsLinkedToPreviousTrack\":true},{\"Position\":8,\"Artist\":\"Artist 8\",\"Title\":\"Title 8\",\"Begin\":\"00:28:28\",\"End\":\"00:36:36\",\"Flags\":[\"4CH\",\"DCP\"],\"IsLinkedToPreviousTrack\":true},{\"Position\":9,\"Artist\":\"Artist 9\",\"Title\":\"Title 9\",\"Begin\":\"00:36:36\",\"End\":\"00:45:45\",\"Flags\":[\"4CH\"],\"IsLinkedToPreviousTrack\":true},{\"Position\":10,\"Artist\":\"Artist 10\",\"Title\":\"Title 10\",\"Begin\":\"00:45:45\",\"End\":\"00:55:55\",\"Flags\":[\"4CH\",\"DCP\"],\"IsLinkedToPreviousTrack\":true}],\"Artist\":\"CuesheetArtist\",\"Title\":\"CuesheetTitle\",\"Audiofile\":{\"Name\":\"AudioFile.mp3\"},\"CDTextfile\":{\"Name\":\"CDTextfile.cdt\"},\"Cataloguenumber\":{\"Value\":\"A123\"},\"Sections\":[{\"Artist\":\"CuesheetArtist\",\"Title\":\"CuesheetTitle\",\"Begin\":\"00:30:00\"},{\"Artist\":\"CuesheetArtist\",\"Title\":\"CuesheetTitle\",\"Begin\":\"01:00:00\"}]}");
var cuesheet = Projectfile.ImportFile(fileContent);
Assert.IsNotNull(cuesheet);
Assert.IsTrue(cuesheet.Tracks.All(x => x.Cuesheet == cuesheet));
@@ -159,9 +159,9 @@ public void ImportFileWithSplitPointsTest()
Assert.IsTrue(Object.ReferenceEquals(cuesheet.Tracks.First(), cuesheet.GetPreviousLinkedTrack(cuesheet.Tracks.ElementAt(1))));
Assert.AreEqual(cuesheet.Tracks.First(), cuesheet.GetPreviousLinkedTrack(cuesheet.Tracks.ElementAt(1)));
Assert.AreEqual((uint)10, cuesheet.Tracks.Last().Position);
- Assert.AreEqual(2, cuesheet.SplitPoints.Count);
- Assert.AreEqual(new TimeSpan(0, 30, 0), cuesheet.SplitPoints.First().Moment);
- Assert.AreEqual(new TimeSpan(1, 0, 0), cuesheet.SplitPoints.Last().Moment);
+ Assert.AreEqual(2, cuesheet.Sections.Count);
+ Assert.AreEqual(new TimeSpan(0, 30, 0), cuesheet.Sections.First().Begin);
+ Assert.AreEqual(new TimeSpan(1, 0, 0), cuesheet.Sections.Last().Begin);
}
}
}
\ No newline at end of file