roadie/Roadie.Api.Library.Tests/RenumberTests.cs

206 lines
9.9 KiB
C#
Raw Normal View History

2019-02-16 21:08:20 +00:00
using Roadie.Library.MetaData.Audio;
using Roadie.Library.MetaData.ID3Tags;
2019-03-06 01:18:21 +00:00
using Roadie.Library.Utility;
2019-02-16 21:08:20 +00:00
using System.Collections.Generic;
2019-03-06 01:18:21 +00:00
using System.Linq;
2019-02-16 21:08:20 +00:00
using Xunit;
namespace Roadie.Library.Tests
{
public class RenumberTests
{
[Theory]
[InlineData(@"2003 - Accelerated Evolution\01 - Depth Charge.mp3")]
[InlineData(@"01 - Depth Charge.mp3")]
[InlineData(@"2003 - Accelerated Evolution\CD1\01 - Depth Charge.mp3")]
[InlineData(@"2003 - Accelerated Evolution\CD01\01 - Depth Charge.mp3")]
[InlineData(@"2003 - Accelerated Evolution\CD001\01 - Depth Charge.mp3")]
[InlineData(@"CD 1\01 - Depth Charge.mp3")]
[InlineData(@"2003 - Accelerated Evolution\CD 01\01 - Depth Charge.mp3")]
[InlineData(@"2003 - Accelerated Evolution\CD 001\01 - Depth Charge.mp3")]
[InlineData(@"Accelerated Evolution CD01\22 - Depth Charge.mp3")]
[InlineData(@"Accelerated Evolution CD1\22 - Depth Charge.mp3")]
public void Find_Disc_Number_Should_Be_One(string filename)
{
var n = ID3TagsHelper.DetermineDiscNumber(new AudioMetaData { Filename = filename });
Assert.Equal(1, n);
}
[Theory]
[InlineData(@"2003 - Accelerated Evolution\CD2\01 - Depth Charge.mp3")]
[InlineData(@"2003 - Accelerated Evolution\CD02\01 - Depth Charge.mp3")]
[InlineData(@"2003 - Accelerated Evolution\CD002\01 - Depth Charge.mp3")]
[InlineData(@"2003 - Accelerated Evolution\CD 2\02 - Depth Charge.mp3")]
[InlineData(@"2003 - Accelerated Evolution\CD 02\01 - Depth Charge.mp3")]
[InlineData(@"2003 - Accelerated Evolution\CD 002\22 - Depth Charge.mp3")]
[InlineData(@"Accelerated Evolution CD2\22 - Depth Charge.mp3")]
[InlineData(@"Accelerated Evolution CD02\22 - Depth Charge.mp3")]
public void Find_Disc_Number_Should_Be_Two(string filename)
{
var n = ID3TagsHelper.DetermineDiscNumber(new AudioMetaData { Filename = filename });
Assert.Equal(2, n);
}
[Fact]
public void Find_Total_Discs_Should_Be_One()
{
var three = new List<AudioMetaData>
{
new AudioMetaData
{
2019-06-02 04:27:17 +00:00
Filename = @"C:\roadie_dev_root\Devin Townsend (1996 - 2016)\The Devin Townsend Band (2003 - 2006)\2003 - Accelerated Evolution\01 - Depth Charge.mp3"
2019-02-16 21:08:20 +00:00
},
new AudioMetaData
{
2019-06-02 04:27:17 +00:00
Filename = @"C:\roadie_dev_root\Devin Townsend (1996 - 2016)\The Devin Townsend Band (2003 - 2006)\2003 - Accelerated Evolution\02 - Not A Depth Charge.mp3"
2019-02-16 21:08:20 +00:00
}
};
var n = ID3TagsHelper.DetermineTotalDiscNumbers(three);
Assert.Equal(1, n);
three = new List<AudioMetaData>
{
new AudioMetaData
{
2019-06-02 04:27:17 +00:00
Filename = @"C:\roadie_dev_root\Devin Townsend (1996 - 2016)\The Devin Townsend Band (2003 - 2006)\2003 - Accelerated Evolution\CD1\01 - Depth Charge.mp3"
2019-02-16 21:08:20 +00:00
},
new AudioMetaData
{
2019-06-02 04:27:17 +00:00
Filename = @"C:\roadie_dev_root\Devin Townsend (1996 - 2016)\The Devin Townsend Band (2003 - 2006)\2003 - Accelerated Evolution\CD1\02 - Not A Depth Charge.mp3"
2019-02-16 21:08:20 +00:00
}
};
n = ID3TagsHelper.DetermineTotalDiscNumbers(three);
Assert.Equal(1, n);
}
[Fact]
public void Find_Total_Discs_Should_Be_Ten()
{
var three = new List<AudioMetaData>
{
new AudioMetaData
{
2019-06-02 04:27:17 +00:00
Filename = @"C:\roadie_dev_root\Devin Townsend (1996 - 2016)\The Devin Townsend Band (2003 - 2006)\2003 - Accelerated Evolution\CD 01\01 - Depth Charge.mp3"
2019-02-16 21:08:20 +00:00
},
new AudioMetaData
{
2019-06-02 04:27:17 +00:00
Filename = @"C:\roadie_dev_root\Devin Townsend (1996 - 2016)\The Devin Townsend Band (2003 - 2006)\2003 - Accelerated Evolution\CD 02\02 - Not A Depth Charge.mp3"
2019-02-16 21:08:20 +00:00
},
new AudioMetaData
{
2019-06-02 04:27:17 +00:00
Filename = @"C:\roadie_dev_root\Devin Townsend (1996 - 2016)\The Devin Townsend Band (2003 - 2006)\2003 - Accelerated Evolution\CD 04\01 - First.mp3"
2019-02-16 21:08:20 +00:00
},
new AudioMetaData
{
2019-06-02 04:27:17 +00:00
Filename = @"C:\roadie_dev_root\Devin Townsend (1996 - 2016)\The Devin Townsend Band (2003 - 2006)\2003 - Accelerated Evolution\CD 06\02 - Second.mp3"
2019-02-16 21:08:20 +00:00
},
new AudioMetaData
{
2019-06-02 04:27:17 +00:00
Filename = @"C:\roadie_dev_root\Devin Townsend (1996 - 2016)\The Devin Townsend Band (2003 - 2006)\2003 - Accelerated Evolution\CD 10\01 - Depth Charge.mp3"
2019-02-16 21:08:20 +00:00
}
};
var n = ID3TagsHelper.DetermineTotalDiscNumbers(three);
Assert.Equal(10, n);
}
[Fact]
public void Find_Total_Discs_Should_Be_Three()
{
var three = new List<AudioMetaData>
{
new AudioMetaData
{
2019-06-02 04:27:17 +00:00
Filename = @"C:\roadie_dev_root\Devin Townsend (1996 - 2016)\The Devin Townsend Band (2003 - 2006)\2003 - Accelerated Evolution\CD 01\01 - Depth Charge.mp3"
2019-02-16 21:08:20 +00:00
},
new AudioMetaData
{
2019-06-02 04:27:17 +00:00
Filename = @"C:\roadie_dev_root\Devin Townsend (1996 - 2016)\The Devin Townsend Band (2003 - 2006)\2003 - Accelerated Evolution\CD 01\02 - Not A Depth Charge.mp3"
2019-02-16 21:08:20 +00:00
},
new AudioMetaData
{
2019-06-02 04:27:17 +00:00
Filename = @"C:\roadie_dev_root\Devin Townsend (1996 - 2016)\The Devin Townsend Band (2003 - 2006)\2003 - Accelerated Evolution\CD 02\01 - First.mp3"
2019-02-16 21:08:20 +00:00
},
new AudioMetaData
{
2019-06-02 04:27:17 +00:00
Filename = @"C:\roadie_dev_root\Devin Townsend (1996 - 2016)\The Devin Townsend Band (2003 - 2006)\2003 - Accelerated Evolution\CD 02\02 - Second.mp3"
2019-02-16 21:08:20 +00:00
},
new AudioMetaData
{
2019-06-02 04:27:17 +00:00
Filename = @"C:\roadie_dev_root\Devin Townsend (1996 - 2016)\The Devin Townsend Band (2003 - 2006)\2003 - Accelerated Evolution\CD 03\01 - Depth Charge.mp3"
2019-02-16 21:08:20 +00:00
},
new AudioMetaData
{
2019-06-02 04:27:17 +00:00
Filename = @"C:\roadie_dev_root\Devin Townsend (1996 - 2016)\The Devin Townsend Band (2003 - 2006)\2003 - Accelerated Evolution\CD 03\02 - Depth Charge.mp3"
2019-02-16 21:08:20 +00:00
},
new AudioMetaData
{
2019-06-02 04:27:17 +00:00
Filename = @"C:\roadie_dev_root\Devin Townsend (1996 - 2016)\The Devin Townsend Band (2003 - 2006)\2003 - Accelerated Evolution\CD 03\03 - Depth Charge.mp3"
2019-02-16 21:08:20 +00:00
},
new AudioMetaData
{
2019-06-02 04:27:17 +00:00
Filename = @"C:\roadie_dev_root\Devin Townsend (1996 - 2016)\The Devin Townsend Band (2003 - 2006)\2003 - Accelerated Evolution\CD 03\04 - Depth Charge.mp3"
2019-02-16 21:08:20 +00:00
}
};
var n = ID3TagsHelper.DetermineTotalDiscNumbers(three);
Assert.Equal(3, n);
}
[Fact]
public void Find_Total_Discs_Should_Be_Two()
{
var three = new List<AudioMetaData>
{
new AudioMetaData
{
2019-06-02 04:27:17 +00:00
Filename = @"C:\roadie_dev_root\Devin Townsend (1996 - 2016)\The Devin Townsend Band (2003 - 2006)\2003 - Accelerated Evolution\CD 01\01 - Depth Charge.mp3"
2019-02-16 21:08:20 +00:00
},
new AudioMetaData
{
2019-06-02 04:27:17 +00:00
Filename = @"C:\roadie_dev_root\Devin Townsend (1996 - 2016)\The Devin Townsend Band (2003 - 2006)\2003 - Accelerated Evolution\CD 01\02 - Not A Depth Charge.mp3"
2019-02-16 21:08:20 +00:00
},
new AudioMetaData
{
2019-06-02 04:27:17 +00:00
Filename = @"C:\roadie_dev_root\Devin Townsend (1996 - 2016)\The Devin Townsend Band (2003 - 2006)\2003 - Accelerated Evolution\CD 01\01 - First.mp3"
2019-02-16 21:08:20 +00:00
},
new AudioMetaData
{
2019-06-02 04:27:17 +00:00
Filename = @"C:\roadie_dev_root\Devin Townsend (1996 - 2016)\The Devin Townsend Band (2003 - 2006)\2003 - Accelerated Evolution\CD 02\02 - Second.mp3"
2019-02-16 21:08:20 +00:00
},
new AudioMetaData
{
2019-06-02 04:27:17 +00:00
Filename = @"C:\roadie_dev_root\Devin Townsend (1996 - 2016)\The Devin Townsend Band (2003 - 2006)\2003 - Accelerated Evolution\CD 01\01 - Depth Charge.mp3"
2019-02-16 21:08:20 +00:00
}
};
var n = ID3TagsHelper.DetermineTotalDiscNumbers(three);
Assert.Equal(2, n);
three = new List<AudioMetaData>
{
new AudioMetaData
{
2019-06-02 04:27:17 +00:00
Filename = @"C:\roadie_dev_root\Devin Townsend (1996 - 2016)\The Devin Townsend Band (2003 - 2006)\2003 - Accelerated Evolution\CD0\01 - Depth Charge.mp3"
2019-02-16 21:08:20 +00:00
},
new AudioMetaData
{
2019-06-02 04:27:17 +00:00
Filename = @"C:\roadie_dev_root\Devin Townsend (1996 - 2016)\The Devin Townsend Band (2003 - 2006)\2003 - Accelerated Evolution\CD2\02 - Not A Depth Charge.mp3"
2019-02-16 21:08:20 +00:00
}
};
n = ID3TagsHelper.DetermineTotalDiscNumbers(three);
Assert.Equal(2, n);
three = new List<AudioMetaData>
{
new AudioMetaData
{
2019-06-02 04:27:17 +00:00
Filename = @"C:\roadie_dev_root\Devin Townsend (1996 - 2016)\The Devin Townsend Band (2003 - 2006)\2003 - Accelerated Evolution\CD 1\01 - Depth Charge.mp3"
2019-02-16 21:08:20 +00:00
},
new AudioMetaData
{
2019-06-02 04:27:17 +00:00
Filename = @"C:\roadie_dev_root\Devin Townsend (1996 - 2016)\The Devin Townsend Band (2003 - 2006)\2003 - Accelerated Evolution\CD 2\02 - Not A Depth Charge.mp3"
2019-02-16 21:08:20 +00:00
}
};
n = ID3TagsHelper.DetermineTotalDiscNumbers(three);
Assert.Equal(2, n);
}
}
}