Check if test file exists before proceeding with test.

This commit is contained in:
2021-03-05 16:36:51 +00:00
parent a2804e4283
commit b5a6420ff7
6 changed files with 111 additions and 14 deletions

View File

@@ -5,9 +5,4 @@
<explicitIncludes />
<explicitExcludes />
</component>
<component name="WorkspaceUserModelUpdater">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.Core;
@@ -31,6 +32,15 @@ namespace Aaru.Tests.Filesystems
foreach(FileSystemTest test in Tests)
{
string testFile = test.TestFile;
bool exists = File.Exists(testFile);
Assert.True(exists, $"{testFile} not found");
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
// It arrives here...
if(!exists)
continue;
var filtersList = new FiltersList();
IFilter inputFilter = filtersList.GetFilter(testFile);
@@ -98,6 +108,15 @@ namespace Aaru.Tests.Filesystems
foreach(FileSystemTest test in Tests)
{
string testFile = test.TestFile;
bool exists = File.Exists(testFile);
Assert.True(exists, $"{testFile} not found");
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
// It arrives here...
if(!exists)
continue;
var filtersList = new FiltersList();
IFilter inputFilter = filtersList.GetFilter(testFile);
@@ -129,6 +148,14 @@ namespace Aaru.Tests.Filesystems
bool found = false;
var partition = new Partition();
bool exists = File.Exists(testFile);
Assert.True(exists, $"{testFile} not found");
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
// It arrives here...
if(!exists)
continue;
var filtersList = new FiltersList();
IFilter inputFilter = filtersList.GetFilter(testFile);

View File

@@ -1,4 +1,5 @@
using System;
using System.IO;
using Aaru.Checksums;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
@@ -23,6 +24,15 @@ namespace Aaru.Tests.Images
foreach(BlockImageTestExpected test in Tests)
{
string testFile = test.TestFile;
bool exists = File.Exists(testFile);
Assert.True(exists, $"{testFile} not found");
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
// It arrives here...
if(!exists)
continue;
var filtersList = new FiltersList();
IFilter filter = filtersList.GetFilter(testFile);
filter.Open(testFile);
@@ -59,6 +69,15 @@ namespace Aaru.Tests.Images
foreach(BlockImageTestExpected test in Tests)
{
string testFile = test.TestFile;
bool exists = File.Exists(testFile);
Assert.True(exists, $"{testFile} not found");
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
// It arrives here...
if(!exists)
continue;
var filtersList = new FiltersList();
IFilter filter = filtersList.GetFilter(testFile);
filter.Open(testFile);

View File

@@ -1,4 +1,5 @@
using System;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Aaru.Checksums;
@@ -27,6 +28,15 @@ namespace Aaru.Tests.Images
foreach(OpticalImageTestExpected test in Tests)
{
string testFile = test.TestFile;
bool exists = File.Exists(testFile);
Assert.True(exists, $"{testFile} not found");
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
// It arrives here...
if(!exists)
continue;
var filtersList = new FiltersList();
IFilter filter = filtersList.GetFilter(testFile);
filter.Open(testFile);
@@ -98,6 +108,15 @@ namespace Aaru.Tests.Images
Parallel.For(0L, Tests.Length, (i, state) =>
{
string testFile = Tests[i].TestFile;
bool exists = File.Exists(testFile);
Assert.True(exists, $"{testFile} not found");
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
// It arrives here...
if(!exists)
return;
var filtersList = new FiltersList();
IFilter filter = filtersList.GetFilter(testFile);
filter.Open(testFile);

View File

@@ -1,4 +1,5 @@
using System;
using System.IO;
using Aaru.Checksums;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
@@ -25,6 +26,15 @@ namespace Aaru.Tests.Images
foreach(TapeImageTestExpected test in Tests)
{
string testFile = test.TestFile;
bool exists = File.Exists(testFile);
Assert.True(exists, $"{testFile} not found");
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
// It arrives here...
if(!exists)
continue;
var filtersList = new FiltersList();
IFilter filter = filtersList.GetFilter(testFile);
filter.Open(testFile);
@@ -64,6 +74,15 @@ namespace Aaru.Tests.Images
foreach(TapeImageTestExpected test in Tests)
{
string testFile = test.TestFile;
bool exists = File.Exists(testFile);
Assert.True(exists, $"{testFile} not found");
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
// It arrives here...
if(!exists)
continue;
var filtersList = new FiltersList();
IFilter filter = filtersList.GetFilter(testFile);
filter.Open(testFile);
@@ -100,6 +119,15 @@ namespace Aaru.Tests.Images
foreach(TapeImageTestExpected test in Tests)
{
string testFile = test.TestFile;
bool exists = File.Exists(testFile);
Assert.True(exists, $"{testFile} not found");
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
// It arrives here...
if(!exists)
continue;
var filtersList = new FiltersList();
IFilter filter = filtersList.GetFilter(testFile);
filter.Open(testFile);

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.Core;
@@ -21,6 +22,14 @@ namespace Aaru.Tests.Partitions
string testFile = test.TestFile;
Environment.CurrentDirectory = DataFolder;
bool exists = File.Exists(testFile);
Assert.True(exists, $"{testFile} not found");
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
// It arrives here...
if(!exists)
continue;
var filtersList = new FiltersList();
IFilter inputFilter = filtersList.GetFilter(testFile);