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;
@@ -30,7 +31,16 @@ namespace Aaru.Tests.Filesystems
{
foreach(FileSystemTest test in Tests)
{
string testFile = test.TestFile;
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);
@@ -97,7 +107,16 @@ namespace Aaru.Tests.Filesystems
{
foreach(FileSystemTest test in Tests)
{
string testFile = test.TestFile;
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;
@@ -22,7 +23,16 @@ namespace Aaru.Tests.Images
{
foreach(BlockImageTestExpected test in Tests)
{
string testFile = test.TestFile;
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);
@@ -58,7 +68,16 @@ namespace Aaru.Tests.Images
{
foreach(BlockImageTestExpected test in Tests)
{
string testFile = test.TestFile;
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;
@@ -26,7 +27,16 @@ namespace Aaru.Tests.Images
{
foreach(OpticalImageTestExpected test in Tests)
{
string testFile = test.TestFile;
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);
@@ -97,7 +107,16 @@ namespace Aaru.Tests.Images
{
Parallel.For(0L, Tests.Length, (i, state) =>
{
string testFile = Tests[i].TestFile;
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;
@@ -24,7 +25,16 @@ namespace Aaru.Tests.Images
{
foreach(TapeImageTestExpected test in Tests)
{
string testFile = test.TestFile;
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);
@@ -63,7 +73,16 @@ namespace Aaru.Tests.Images
{
foreach(TapeImageTestExpected test in Tests)
{
string testFile = test.TestFile;
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);
@@ -99,7 +118,16 @@ namespace Aaru.Tests.Images
{
foreach(TapeImageTestExpected test in Tests)
{
string testFile = test.TestFile;
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);