From fb281a434dcef5bb68a2cba09f99f5dead6e8ea2 Mon Sep 17 00:00:00 2001 From: Jeremy Powell Date: Thu, 5 Dec 2024 21:34:18 +1300 Subject: [PATCH] Improve handling test errors --- OpenMcdf.Tests/RootStorageTests.cs | 4 ++-- OpenMcdf.Tests/StorageTests.cs | 2 +- OpenMcdf.Tests/StreamTests.cs | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/OpenMcdf.Tests/RootStorageTests.cs b/OpenMcdf.Tests/RootStorageTests.cs index c729f58..c8a3c81 100644 --- a/OpenMcdf.Tests/RootStorageTests.cs +++ b/OpenMcdf.Tests/RootStorageTests.cs @@ -101,7 +101,7 @@ public void ConsolidateFile(Version version, StorageModeFlags flags) } finally { - File.Delete(fileName); + try { File.Delete(fileName); } catch { } } } @@ -171,7 +171,7 @@ public void SwitchFile(Version version, int subStorageCount) } finally { - File.Delete(fileName); + try { File.Delete(fileName); } catch { } } } } diff --git a/OpenMcdf.Tests/StorageTests.cs b/OpenMcdf.Tests/StorageTests.cs index e5e3d6d..06a709b 100644 --- a/OpenMcdf.Tests/StorageTests.cs +++ b/OpenMcdf.Tests/StorageTests.cs @@ -143,7 +143,7 @@ public void CreateStorageFile(Version version, int subStorageCount) } finally { - File.Delete(fileName); + try { File.Delete(fileName); } catch { } } } diff --git a/OpenMcdf.Tests/StreamTests.cs b/OpenMcdf.Tests/StreamTests.cs index 3a52694..634079a 100644 --- a/OpenMcdf.Tests/StreamTests.cs +++ b/OpenMcdf.Tests/StreamTests.cs @@ -211,6 +211,8 @@ public void StructuredStorageWriteThenRead(Version version, int length) stream.ReadExactly(actualBuffer); CollectionAssert.AreEqual(expectedBuffer, actualBuffer); } + + try { File.Delete(fileName); } catch { } } #endif