2021-03-03 14:52:05 +00:00
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using Aaru.CommonTypes;
|
|
|
|
|
using Aaru.CommonTypes.Interfaces;
|
|
|
|
|
using Aaru.Core;
|
|
|
|
|
using FluentAssertions;
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
|
|
|
|
|
namespace Aaru.Tests.Partitions
|
|
|
|
|
{
|
|
|
|
|
public abstract class PartitionSchemeTest
|
|
|
|
|
{
|
2021-03-03 15:11:22 +00:00
|
|
|
public abstract string DataFolder { get; }
|
|
|
|
|
public abstract PartitionTest[] Tests { get; }
|
2021-03-03 14:52:05 +00:00
|
|
|
|
|
|
|
|
[Test]
|
2021-03-03 15:11:22 +00:00
|
|
|
public void Test2()
|
2021-03-03 14:52:05 +00:00
|
|
|
{
|
2021-03-03 15:11:22 +00:00
|
|
|
foreach(PartitionTest test in Tests)
|
2021-03-03 14:52:05 +00:00
|
|
|
{
|
2021-03-03 15:11:22 +00:00
|
|
|
string testFile = test.TestFile;
|
2021-03-03 14:52:05 +00:00
|
|
|
Environment.CurrentDirectory = DataFolder;
|
|
|
|
|
|
|
|
|
|
var filtersList = new FiltersList();
|
2021-03-03 15:11:22 +00:00
|
|
|
IFilter inputFilter = filtersList.GetFilter(testFile);
|
2021-03-03 14:52:05 +00:00
|
|
|
|
2021-03-03 15:11:22 +00:00
|
|
|
Assert.IsNotNull(inputFilter, $"Filter: {testFile}");
|
2021-03-03 14:52:05 +00:00
|
|
|
|
|
|
|
|
IMediaImage image = ImageFormat.Detect(inputFilter);
|
|
|
|
|
|
2021-03-03 15:11:22 +00:00
|
|
|
Assert.IsNotNull(image, $"Image format: {testFile}");
|
2021-03-03 14:52:05 +00:00
|
|
|
|
2021-03-03 15:11:22 +00:00
|
|
|
Assert.AreEqual(true, image.Open(inputFilter), $"Cannot open image for {testFile}");
|
2021-03-03 14:52:05 +00:00
|
|
|
|
|
|
|
|
List<Partition> partitions = Core.Partitions.GetAll(image);
|
|
|
|
|
|
2021-03-03 15:11:22 +00:00
|
|
|
partitions.Should().BeEquivalentTo(test.Partitions, $"Partitions: {testFile}");
|
2021-03-03 14:52:05 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|