From 832e5c71d095d5a479b5f05bbf724b3103b7f246 Mon Sep 17 00:00:00 2001 From: Pascal Berger Date: Thu, 10 Oct 2019 21:23:16 +0200 Subject: [PATCH] Update test robustness --- .../IssueSerializationExtensionsTests.cs | 130 ++++++++++++++---- 1 file changed, 104 insertions(+), 26 deletions(-) diff --git a/src/Cake.Issues.Tests/Serialization/IssueSerializationExtensionsTests.cs b/src/Cake.Issues.Tests/Serialization/IssueSerializationExtensionsTests.cs index 343ab1f3d..a280ff2af 100644 --- a/src/Cake.Issues.Tests/Serialization/IssueSerializationExtensionsTests.cs +++ b/src/Cake.Issues.Tests/Serialization/IssueSerializationExtensionsTests.cs @@ -687,7 +687,10 @@ public void Should_Give_Correct_Result_For_MessageText_After_Roundtrip() } finally { - System.IO.File.Delete(filePath.FullPath); + if (System.IO.File.Exists(filePath.FullPath)) + { + System.IO.File.Delete(filePath.FullPath); + } } } @@ -714,7 +717,10 @@ public void Should_Give_Correct_Result_For_MessageMarkdown_After_Roundtrip() } finally { - System.IO.File.Delete(filePath.FullPath); + if (System.IO.File.Exists(filePath.FullPath)) + { + System.IO.File.Delete(filePath.FullPath); + } } } @@ -741,7 +747,10 @@ public void Should_Give_Correct_Result_For_MessageHtml_After_Roundtrip() } finally { - System.IO.File.Delete(filePath.FullPath); + if (System.IO.File.Exists(filePath.FullPath)) + { + System.IO.File.Delete(filePath.FullPath); + } } } @@ -767,7 +776,10 @@ public void Should_Give_Correct_Result_For_ProviderType_After_Roundtrip() } finally { - System.IO.File.Delete(filePath.FullPath); + if (System.IO.File.Exists(filePath.FullPath)) + { + System.IO.File.Delete(filePath.FullPath); + } } } @@ -793,7 +805,10 @@ public void Should_Give_Correct_Result_For_ProviderName_After_Roundtrip() } finally { - System.IO.File.Delete(filePath.FullPath); + if (System.IO.File.Exists(filePath.FullPath)) + { + System.IO.File.Delete(filePath.FullPath); + } } } @@ -820,7 +835,10 @@ public void Should_Give_Correct_Result_For_ProjectFileRelativePath_After_Roundtr } finally { - System.IO.File.Delete(filePath.FullPath); + if (System.IO.File.Exists(filePath.FullPath)) + { + System.IO.File.Delete(filePath.FullPath); + } } } @@ -847,7 +865,10 @@ public void Should_Give_Correct_Result_For_ProjectName_After_Roundtrip() } finally { - System.IO.File.Delete(filePath.FullPath); + if (System.IO.File.Exists(filePath.FullPath)) + { + System.IO.File.Delete(filePath.FullPath); + } } } @@ -874,7 +895,10 @@ public void Should_Give_Correct_Result_For_AffectedFileRelativePath_After_Roundt } finally { - System.IO.File.Delete(filePath.FullPath); + if (System.IO.File.Exists(filePath.FullPath)) + { + System.IO.File.Delete(filePath.FullPath); + } } } @@ -901,7 +925,10 @@ public void Should_Give_Correct_Result_For_Line_After_Roundtrip() } finally { - System.IO.File.Delete(filePath.FullPath); + if (System.IO.File.Exists(filePath.FullPath)) + { + System.IO.File.Delete(filePath.FullPath); + } } } @@ -928,7 +955,10 @@ public void Should_Give_Correct_Result_For_Priority_After_Roundtrip() } finally { - System.IO.File.Delete(filePath.FullPath); + if (System.IO.File.Exists(filePath.FullPath)) + { + System.IO.File.Delete(filePath.FullPath); + } } } @@ -955,7 +985,10 @@ public void Should_Give_Correct_Result_For_PriorityName_After_Roundtrip() } finally { - System.IO.File.Delete(filePath.FullPath); + if (System.IO.File.Exists(filePath.FullPath)) + { + System.IO.File.Delete(filePath.FullPath); + } } } @@ -982,7 +1015,10 @@ public void Should_Give_Correct_Result_For_Rule_After_Roundtrip() } finally { - System.IO.File.Delete(filePath.FullPath); + if (System.IO.File.Exists(filePath.FullPath)) + { + System.IO.File.Delete(filePath.FullPath); + } } } @@ -1009,7 +1045,10 @@ public void Should_Give_Correct_Result_For_RuleUrl_After_Roundtrip() } finally { - System.IO.File.Delete(filePath.FullPath); + if (System.IO.File.Exists(filePath.FullPath)) + { + System.IO.File.Delete(filePath.FullPath); + } } } } @@ -1075,7 +1114,10 @@ public void Should_Give_Correct_Result_For_MessageText_After_Roundtrip() } finally { - System.IO.File.Delete(filePath.FullPath); + if (System.IO.File.Exists(filePath.FullPath)) + { + System.IO.File.Delete(filePath.FullPath); + } } } @@ -1112,7 +1154,10 @@ public void Should_Give_Correct_Result_For_MessageMarkdown_After_Roundtrip() } finally { - System.IO.File.Delete(filePath.FullPath); + if (System.IO.File.Exists(filePath.FullPath)) + { + System.IO.File.Delete(filePath.FullPath); + } } } @@ -1149,7 +1194,10 @@ public void Should_Give_Correct_Result_For_MessageHtml_After_Roundtrip() } finally { - System.IO.File.Delete(filePath.FullPath); + if (System.IO.File.Exists(filePath.FullPath)) + { + System.IO.File.Delete(filePath.FullPath); + } } } @@ -1184,7 +1232,10 @@ public void Should_Give_Correct_Result_For_ProviderType_After_Roundtrip() } finally { - System.IO.File.Delete(filePath.FullPath); + if (System.IO.File.Exists(filePath.FullPath)) + { + System.IO.File.Delete(filePath.FullPath); + } } } @@ -1219,7 +1270,10 @@ public void Should_Give_Correct_Result_For_ProviderName_After_Roundtrip() } finally { - System.IO.File.Delete(filePath.FullPath); + if (System.IO.File.Exists(filePath.FullPath)) + { + System.IO.File.Delete(filePath.FullPath); + } } } @@ -1256,7 +1310,10 @@ public void Should_Give_Correct_Result_For_ProjectFileRelativePath_After_Roundtr } finally { - System.IO.File.Delete(filePath.FullPath); + if (System.IO.File.Exists(filePath.FullPath)) + { + System.IO.File.Delete(filePath.FullPath); + } } } @@ -1293,7 +1350,10 @@ public void Should_Give_Correct_Result_For_ProjectName_After_Roundtrip() } finally { - System.IO.File.Delete(filePath.FullPath); + if (System.IO.File.Exists(filePath.FullPath)) + { + System.IO.File.Delete(filePath.FullPath); + } } } @@ -1330,7 +1390,10 @@ public void Should_Give_Correct_Result_For_AffectedFileRelativePath_After_Roundt } finally { - System.IO.File.Delete(filePath.FullPath); + if (System.IO.File.Exists(filePath.FullPath)) + { + System.IO.File.Delete(filePath.FullPath); + } } } @@ -1367,7 +1430,10 @@ public void Should_Give_Correct_Result_For_Line_After_Roundtrip() } finally { - System.IO.File.Delete(filePath.FullPath); + if (System.IO.File.Exists(filePath.FullPath)) + { + System.IO.File.Delete(filePath.FullPath); + } } } @@ -1404,7 +1470,10 @@ public void Should_Give_Correct_Result_For_Priority_After_Roundtrip() } finally { - System.IO.File.Delete(filePath.FullPath); + if (System.IO.File.Exists(filePath.FullPath)) + { + System.IO.File.Delete(filePath.FullPath); + } } } @@ -1441,7 +1510,10 @@ public void Should_Give_Correct_Result_For_PriorityName_After_Roundtrip() } finally { - System.IO.File.Delete(filePath.FullPath); + if (System.IO.File.Exists(filePath.FullPath)) + { + System.IO.File.Delete(filePath.FullPath); + } } } @@ -1478,7 +1550,10 @@ public void Should_Give_Correct_Result_For_Rule_After_Roundtrip() } finally { - System.IO.File.Delete(filePath.FullPath); + if (System.IO.File.Exists(filePath.FullPath)) + { + System.IO.File.Delete(filePath.FullPath); + } } } @@ -1515,7 +1590,10 @@ public void Should_Give_Correct_Result_For_RuleUrl_After_Roundtrip() } finally { - System.IO.File.Delete(filePath.FullPath); + if (System.IO.File.Exists(filePath.FullPath)) + { + System.IO.File.Delete(filePath.FullPath); + } } } }