namespace Aaru.Tests.Issues;
using System;
using System.Collections.Generic;
using System.IO;
using Aaru.Checksums;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.CommonTypes.Structs;
using Aaru.Core;
using NUnit.Framework;
/// This class will test an issue that happens when reading an image completely, from start to end, crashes.
public abstract class OpticalImageReadIssueTest
{
const uint SECTORS_TO_READ = 256;
public abstract string DataFolder { get; }
public abstract string TestFile { get; }
[Test]
public void Test()
{
Environment.CurrentDirectory = DataFolder;
bool exists = File.Exists(TestFile);
Assert.True(exists, "Test file not found");
var filtersList = new FiltersList();
IFilter inputFilter = filtersList.GetFilter(TestFile);
Assert.IsNotNull(inputFilter, "Filter for test file is not detected");
var image = ImageFormat.Detect(inputFilter) as IMediaImage;
Assert.IsNotNull(image, "Image format for test file is not detected");
Assert.AreEqual(ErrorNumber.NoError, image.Open(inputFilter), "Cannot open image for test file");
var opticalInput = image as IOpticalMediaImage;
Assert.IsNotNull(opticalInput, "Image format for test file is not for an optical disc");
var ctx = new Crc32Context();
ulong previousTrackEnd = 0;
List