From e9044071064df9fe6d59f1b4e4a4f6c16fcd5aa6 Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Sat, 11 May 2024 17:26:55 +1000 Subject: [PATCH] . --- docs/ApprovalTests/Features.md | 25 +----- .../CustomizingDiffToolSelectionOrder.md | 28 +----- src/ApprovalTests.NUnit3/GlobalUsings.cs | 25 +----- .../Reporters/AssemblyLevelTest.cs | 12 --- .../Reporters/CustomDiffReporter.cs | 22 ----- ...ingReporterTest.TestException.approved.txt | 1 - .../Reporters/FirstWorkingReporterTest.cs | 72 --------------- ...extReporterTest.CSharpStrings.approved.txt | 9 -- .../Reporters/InlineTextReporterTest.cs | 64 ------------- ...ctionReporterTest.TestComment.approved.txt | 31 ------- .../Reporters/IntroductionReporterTest.cs | 7 -- .../Reporters/MultiReporterTest.cs | 27 ------ ...boardReporterTest.TestCommand.approved.txt | 1 - .../PowerShellClipboardReporterTest.cs | 7 -- .../Reporters/RecordingReporter.cs | 18 ---- .../Reporters/ReporterFactoryTest.cs | 89 ------------------- ...estInvalidReporterShouldThrow.approved.txt | 9 -- ...ithInvalidReporterShouldThrow.approved.txt | 9 -- .../Reporters/ReporterTest.cs | 41 --------- ...oiseImageDiffTest.TestIsImage.approved.txt | 9 -- .../Reporters/TortoiseImageDiffTest.cs | 21 ----- src/ApprovalTests.NUnit3/UnixLineEndings.txt | 2 - .../WindowsLineEndings.txt | 2 - 23 files changed, 4 insertions(+), 527 deletions(-) delete mode 100644 src/ApprovalTests.NUnit3/Reporters/AssemblyLevelTest.cs delete mode 100644 src/ApprovalTests.NUnit3/Reporters/CustomDiffReporter.cs delete mode 100644 src/ApprovalTests.NUnit3/Reporters/FirstWorkingReporterTest.TestException.approved.txt delete mode 100644 src/ApprovalTests.NUnit3/Reporters/FirstWorkingReporterTest.cs delete mode 100644 src/ApprovalTests.NUnit3/Reporters/InlineTextReporterTest.CSharpStrings.approved.txt delete mode 100644 src/ApprovalTests.NUnit3/Reporters/InlineTextReporterTest.cs delete mode 100644 src/ApprovalTests.NUnit3/Reporters/IntroductionReporterTest.TestComment.approved.txt delete mode 100644 src/ApprovalTests.NUnit3/Reporters/IntroductionReporterTest.cs delete mode 100644 src/ApprovalTests.NUnit3/Reporters/MultiReporterTest.cs delete mode 100644 src/ApprovalTests.NUnit3/Reporters/PowerShellClipboardReporterTest.TestCommand.approved.txt delete mode 100644 src/ApprovalTests.NUnit3/Reporters/PowerShellClipboardReporterTest.cs delete mode 100644 src/ApprovalTests.NUnit3/Reporters/RecordingReporter.cs delete mode 100644 src/ApprovalTests.NUnit3/Reporters/ReporterFactoryTest.cs delete mode 100644 src/ApprovalTests.NUnit3/Reporters/ReporterTest.TestInvalidReporterShouldThrow.approved.txt delete mode 100644 src/ApprovalTests.NUnit3/Reporters/ReporterTest.TestMultipleWithInvalidReporterShouldThrow.approved.txt delete mode 100644 src/ApprovalTests.NUnit3/Reporters/ReporterTest.cs delete mode 100644 src/ApprovalTests.NUnit3/Reporters/TortoiseImageDiffTest.TestIsImage.approved.txt delete mode 100644 src/ApprovalTests.NUnit3/Reporters/TortoiseImageDiffTest.cs delete mode 100644 src/ApprovalTests.NUnit3/UnixLineEndings.txt delete mode 100644 src/ApprovalTests.NUnit3/WindowsLineEndings.txt diff --git a/docs/ApprovalTests/Features.md b/docs/ApprovalTests/Features.md index 332a346c..0411f508 100644 --- a/docs/ApprovalTests/Features.md +++ b/docs/ApprovalTests/Features.md @@ -34,15 +34,7 @@ var actual = header.MakeHeading("I am ten chars"); var expected = ""; Approvals.AssertText(expected, actual); ``` -snippet source | anchor - -```cs -var header = new Header(); -var actual = header.MakeHeading("I am ten chars"); -var expected = ""; -Approvals.AssertText(expected, actual); -``` -snippet source | anchor +snippet source | anchor When you do this, it will copy the c# for the `.received.` to your clipboard, so you can paste it in-line. @@ -61,20 +53,7 @@ var expected = new[]{ }; Approvals.AssertText(expected, actual); ``` -snippet source | anchor - -```cs -var header = new Header(); -var actual = header.MakeHeading("I am ten chars"); -var expected = new[]{ - "**************", - "I am ten chars", - "**************", - -}; -Approvals.AssertText(expected, actual); -``` -snippet source | anchor +snippet source | anchor diff --git a/docs/ApprovalTests/howtos/CustomizingDiffToolSelectionOrder.md b/docs/ApprovalTests/howtos/CustomizingDiffToolSelectionOrder.md index 507bd0d1..b0cf3d86 100644 --- a/docs/ApprovalTests/howtos/CustomizingDiffToolSelectionOrder.md +++ b/docs/ApprovalTests/howtos/CustomizingDiffToolSelectionOrder.md @@ -44,33 +44,7 @@ public class CustomDiffReporter : } } ``` -snippet source | anchor - -```cs -using ApprovalTests.Reporters.TestFrameworks; - -public class CustomDiffReporter : - FirstWorkingReporter -{ - public CustomDiffReporter() - : base( - //TODO: re-order or remove as required - BeyondCompareReporter.INSTANCE, - TortoiseDiffReporter.INSTANCE, - AraxisMergeReporter.INSTANCE, - P4MergeReporter.INSTANCE, - WinMergeReporter.INSTANCE, - KDiff3Reporter.INSTANCE, - VisualStudioReporter.INSTANCE, - RiderReporter.INSTANCE, - FrameworkAssertReporter.INSTANCE, - QuietReporter.INSTANCE - ) - { - } -} -``` -snippet source | anchor +snippet source | anchor You can also override the default order while using `DiffReporter` by defining `DiffEngine_ToolOrder` environment variable. The value of that variable should contain a delimiter (`,`, `|`, ` `) separated list of the diff tool names in the desired order. More details about that in [Diff Tool Order](https://github.com/VerifyTests/DiffEngine/blob/main/docs/diff-tool.order.md) diff --git a/src/ApprovalTests.NUnit3/GlobalUsings.cs b/src/ApprovalTests.NUnit3/GlobalUsings.cs index 42300ac5..3369c9a1 100644 --- a/src/ApprovalTests.NUnit3/GlobalUsings.cs +++ b/src/ApprovalTests.NUnit3/GlobalUsings.cs @@ -1,26 +1,3 @@ -global using System.Diagnostics; -global using System.Globalization; -global using System.Net; -global using System.Runtime.CompilerServices; -global using ApprovalTests; -global using ApprovalTests.Approvers; -global using ApprovalTests.Combinations; -global using ApprovalTests.Core; -global using ApprovalTests.Core.Exceptions; -global using ApprovalTests.Email; -global using ApprovalTests.Events; -global using ApprovalTests.ExceptionalExceptions; -global using ApprovalTests.Maintenance; -global using ApprovalTests.Namers; -global using ApprovalTests.Namers.StackTraceParsers; +global using ApprovalTests; global using ApprovalTests.Reporters; -global using ApprovalTests.Scrubber; -global using ApprovalTests.Utilities; -global using ApprovalTests.WindowsRegistry; -global using ApprovalUtilities.Persistence; -global using ApprovalUtilities.SimpleLogger; -global using ApprovalUtilities.Utilities; -global using iText.Kernel.Pdf; -global using iText.Layout; -global using iText.Layout.Element; global using NUnit.Framework; \ No newline at end of file diff --git a/src/ApprovalTests.NUnit3/Reporters/AssemblyLevelTest.cs b/src/ApprovalTests.NUnit3/Reporters/AssemblyLevelTest.cs deleted file mode 100644 index cedfd3cf..00000000 --- a/src/ApprovalTests.NUnit3/Reporters/AssemblyLevelTest.cs +++ /dev/null @@ -1,12 +0,0 @@ -[TestFixture] -public class AssemblyLevelTest -{ - [Test] - public void TestClassLevel() - { - using (Approvals.SetFrontLoadedReporter(ReportWithoutFrontLoading.INSTANCE)) - { - Assert.AreEqual(typeof(DiffReporter), Approvals.GetReporter().GetType()); - } - } -} \ No newline at end of file diff --git a/src/ApprovalTests.NUnit3/Reporters/CustomDiffReporter.cs b/src/ApprovalTests.NUnit3/Reporters/CustomDiffReporter.cs deleted file mode 100644 index 06a15c0f..00000000 --- a/src/ApprovalTests.NUnit3/Reporters/CustomDiffReporter.cs +++ /dev/null @@ -1,22 +0,0 @@ -using ApprovalTests.Reporters.TestFrameworks; - -public class CustomDiffReporter : - FirstWorkingReporter -{ - public CustomDiffReporter() - : base( - //TODO: re-order or remove as required - BeyondCompareReporter.INSTANCE, - TortoiseDiffReporter.INSTANCE, - AraxisMergeReporter.INSTANCE, - P4MergeReporter.INSTANCE, - WinMergeReporter.INSTANCE, - KDiff3Reporter.INSTANCE, - VisualStudioReporter.INSTANCE, - RiderReporter.INSTANCE, - FrameworkAssertReporter.INSTANCE, - QuietReporter.INSTANCE - ) - { - } -} \ No newline at end of file diff --git a/src/ApprovalTests.NUnit3/Reporters/FirstWorkingReporterTest.TestException.approved.txt b/src/ApprovalTests.NUnit3/Reporters/FirstWorkingReporterTest.TestException.approved.txt deleted file mode 100644 index 19a76f13..00000000 --- a/src/ApprovalTests.NUnit3/Reporters/FirstWorkingReporterTest.TestException.approved.txt +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/ApprovalTests.NUnit3/Reporters/FirstWorkingReporterTest.cs b/src/ApprovalTests.NUnit3/Reporters/FirstWorkingReporterTest.cs deleted file mode 100644 index 231424f2..00000000 --- a/src/ApprovalTests.NUnit3/Reporters/FirstWorkingReporterTest.cs +++ /dev/null @@ -1,72 +0,0 @@ -[TestFixture] -public class FirstWorkingReporterTest -{ - [Test] - public void TestCallsFirstAndOnlyFirst() - { - var a = new RecordingReporter(false); - var b = new RecordingReporter(true); - var c = new RecordingReporter(true); - - var reporter = new FirstWorkingReporter(a, b, c); - Assert.IsTrue(reporter.IsWorkingInThisEnvironment("default.txt")); - reporter.Report("a", "b"); - Assert.IsNull(a.CalledWith); - Assert.AreEqual("a,b", b.CalledWith); - Assert.IsNull(c.CalledWith); - } - - [Test] - public void TestException() - { - if (DiffEngine.BuildServerDetector.Detected) - { - // DiffReporter not detected on CI - return; - } - File.Create("received.notreal").Close(); - try - { - var ex = ExceptionUtilities.GetException(() => new DiffReporter().Report("received.notreal", "received.notreal")); - Assert.AreEqual("Could not find a diff tool for extension: .notreal", ex.Message); - } - finally - { - File.Delete("received.notreal"); - } - } - - [Test] - public void TestCleanup() - { - var cleanup1 = new MockCleanup(); - var cleanup2 = new MockCleanup(); - var r = new FirstWorkingReporter(cleanup1, new QuietReporter(), cleanup2); - r.CleanUp("a", "r"); - Assert.AreEqual("a", cleanup1.approved); - Assert.AreEqual("a", cleanup2.approved); - Assert.AreEqual("r", cleanup1.received); - Assert.AreEqual("r", cleanup2.received); - } -} - -public class MockCleanup : IEnvironmentAwareReporter, IApprovalReporterWithCleanUp -{ - public string approved; - public string received; - - public void Report(string approved, string received) - { - } - - public bool IsWorkingInThisEnvironment(string forFile) - { - return false; - } - - public void CleanUp(string approved, string received) - { - this.approved = approved; - this.received = received; - } -} \ No newline at end of file diff --git a/src/ApprovalTests.NUnit3/Reporters/InlineTextReporterTest.CSharpStrings.approved.txt b/src/ApprovalTests.NUnit3/Reporters/InlineTextReporterTest.CSharpStrings.approved.txt deleted file mode 100644 index de9443f2..00000000 --- a/src/ApprovalTests.NUnit3/Reporters/InlineTextReporterTest.CSharpStrings.approved.txt +++ /dev/null @@ -1,9 +0,0 @@ -C# Strings - -var expected = "boo"; -var expected = "with \"quotes\"."; - var expected = new[]{ - "**************", - "I am ten chars", - "**************", - }; diff --git a/src/ApprovalTests.NUnit3/Reporters/InlineTextReporterTest.cs b/src/ApprovalTests.NUnit3/Reporters/InlineTextReporterTest.cs deleted file mode 100644 index 337db344..00000000 --- a/src/ApprovalTests.NUnit3/Reporters/InlineTextReporterTest.cs +++ /dev/null @@ -1,64 +0,0 @@ -[TestFixture] -public class InlineTextReporterTest -{ - [Test] - public void TestComment() - { - var actual = "Hello"; - var expected = "Hello"; - Approvals.AssertText(expected, actual); - } - - [Test] - public void CSharpStrings() - { - var example1 = new[] - { - "**************", - - "I am ten chars", - "**************", - }; - var samples = new[] { "boo","with \"quotes\".", example1.JoinWith("\n"), }; - - Approvals.VerifyAll("C# Strings", samples, InlineTextReporter.ConvertToCSharp); - } - - [Test] - public void MakerHeadertest() - { - // begin-snippet: assert_text - var header = new Header(); - var actual = header.MakeHeading("I am ten chars"); - var expected = new[]{ - "**************", - "I am ten chars", - "**************", - - }; - Approvals.AssertText(expected, actual); - // end-snippet - } - - public void MakerHeaderBefore() - { - // begin-snippet: assert_text_before - var header = new Header(); - var actual = header.MakeHeading("I am ten chars"); - var expected = ""; - Approvals.AssertText(expected, actual); - // end-snippet - } -} - -public class Header -{ - public string MakeHeading(string iAmTenChars) => - new[] - { - "**************", - - "I am ten chars", - "**************", - }.JoinWith("\n"); -} \ No newline at end of file diff --git a/src/ApprovalTests.NUnit3/Reporters/IntroductionReporterTest.TestComment.approved.txt b/src/ApprovalTests.NUnit3/Reporters/IntroductionReporterTest.TestComment.approved.txt deleted file mode 100644 index 17d34576..00000000 --- a/src/ApprovalTests.NUnit3/Reporters/IntroductionReporterTest.TestComment.approved.txt +++ /dev/null @@ -1,31 +0,0 @@ -Welcome to ApprovalTests. -==== - -Please add: - -``` -[UseReporter(typeof(DiffReporter))] -``` - -to your class, test method or assembly. - -Why: ----- - -ApprovalTests uses the `[UseReporter]` attribute from your test class, method or assembly. When you do this ApprovalTest will launch the result using that reporter, for example in your diff tool. - -You can find several reporters in `ApprovalTests.Reporters` namespace, or create your own by extending the `ApprovalTests.Core.IApprovalFailureReporter` interface. - -Find more at: http://blog.approvaltests.com/2011/12/using-reporters-in-approval-tests.html - -Best Practice: ----- - -Add an *assembly* level configuration. Create a file in your base directory with the name `ApprovalTestsConfig.cs`, and the contents: - -``` -using ApprovalTests.Reporters; - -[assembly: UseReporter(typeof(DiffReporter))] -``` - diff --git a/src/ApprovalTests.NUnit3/Reporters/IntroductionReporterTest.cs b/src/ApprovalTests.NUnit3/Reporters/IntroductionReporterTest.cs deleted file mode 100644 index 7ad4fc37..00000000 --- a/src/ApprovalTests.NUnit3/Reporters/IntroductionReporterTest.cs +++ /dev/null @@ -1,7 +0,0 @@ -[TestFixture] -public class IntroductionReporterTest -{ - [Test] - public void TestComment() => - Approvals.Verify(new IntroductionReporter().GetFriendlyWelcomeMessage()); -} \ No newline at end of file diff --git a/src/ApprovalTests.NUnit3/Reporters/MultiReporterTest.cs b/src/ApprovalTests.NUnit3/Reporters/MultiReporterTest.cs deleted file mode 100644 index c5f11da7..00000000 --- a/src/ApprovalTests.NUnit3/Reporters/MultiReporterTest.cs +++ /dev/null @@ -1,27 +0,0 @@ -using ApprovalTests.Reporters.TestFrameworks; - -[TestFixture] -public class MultiReporterTest -{ - [Test] - public void TestMultiReporter() - { - var a = new RecordingReporter(); - var b = new RecordingReporter(); - var multi = new MultiReporter(a, b); - multi.Report("a", "r"); - Assert.AreEqual("a,r", a.CalledWith); - Assert.AreEqual("a,r", b.CalledWith); - } - - [Test] - public void TestCallAfterException() - { - var a = new NUnitReporter(); - var b = new RecordingReporter(); - var multi = new MultiReporter(a, b); - var exception = ExceptionUtilities.GetException(() => multi.Report("a", "r")); - Assert.AreEqual("a,r", b.CalledWith); - Assert.IsInstanceOf(exception); - } -} \ No newline at end of file diff --git a/src/ApprovalTests.NUnit3/Reporters/PowerShellClipboardReporterTest.TestCommand.approved.txt b/src/ApprovalTests.NUnit3/Reporters/PowerShellClipboardReporterTest.TestCommand.approved.txt deleted file mode 100644 index cac24d5e..00000000 --- a/src/ApprovalTests.NUnit3/Reporters/PowerShellClipboardReporterTest.TestCommand.approved.txt +++ /dev/null @@ -1 +0,0 @@ -Move-Item "c:\temp\recieved.txt" "c:\temp\approved.txt" -Force \ No newline at end of file diff --git a/src/ApprovalTests.NUnit3/Reporters/PowerShellClipboardReporterTest.cs b/src/ApprovalTests.NUnit3/Reporters/PowerShellClipboardReporterTest.cs deleted file mode 100644 index 11e0c13c..00000000 --- a/src/ApprovalTests.NUnit3/Reporters/PowerShellClipboardReporterTest.cs +++ /dev/null @@ -1,7 +0,0 @@ -[TestFixture] -public class PowerShellClipboardReporterTest -{ - [Test] - public void TestCommand() => - Approvals.Verify(PowerShellClipboardReporter.GetCommandLineForApproval(@"c:\temp\approved.txt", @"c:\temp\recieved.txt")); -} \ No newline at end of file diff --git a/src/ApprovalTests.NUnit3/Reporters/RecordingReporter.cs b/src/ApprovalTests.NUnit3/Reporters/RecordingReporter.cs deleted file mode 100644 index 513cb5e5..00000000 --- a/src/ApprovalTests.NUnit3/Reporters/RecordingReporter.cs +++ /dev/null @@ -1,18 +0,0 @@ -public class RecordingReporter : IEnvironmentAwareReporter -{ - readonly bool working; - - public RecordingReporter() => - working = true; - - public RecordingReporter(bool working) => - this.working = working; - - public void Report(string approved, string received) => - CalledWith = $"{approved},{received}"; - - public bool IsWorkingInThisEnvironment(string forFile) => - working; - - public string CalledWith { get; set; } -} \ No newline at end of file diff --git a/src/ApprovalTests.NUnit3/Reporters/ReporterFactoryTest.cs b/src/ApprovalTests.NUnit3/Reporters/ReporterFactoryTest.cs deleted file mode 100644 index 292fc9ed..00000000 --- a/src/ApprovalTests.NUnit3/Reporters/ReporterFactoryTest.cs +++ /dev/null @@ -1,89 +0,0 @@ -[TestFixture] -[UseReporter(typeof(ClassLevelReporter))] -public class ReporterFactoryTest -{ - static IEnumerable GetSingletonReporterTypes() - { - var types = typeof(UseReporterAttribute).Assembly.GetTypes(); - var reporters = types.Where(r => r.GetInterfaces().Contains(typeof(IApprovalFailureReporter))); - var singletons = reporters.Where(r => r.GetConstructor(Type.EmptyTypes) != null); - return singletons; - } - - static void SubMethod() => - Assert.AreEqual(typeof(MethodLevelReporter), Approvals.GetReporter().GetType()); - - [Test] - public void TestClassLevel() - { - using (Approvals.SetFrontLoadedReporter(ReportWithoutFrontLoading.INSTANCE)) - { - Assert.AreEqual(typeof(ClassLevelReporter), Approvals.GetReporter().GetType()); - } - } - - [Test] - [UseReporter(typeof(MethodLevelReporter))] - public void TestMethodOverride() - { - using (Approvals.SetFrontLoadedReporter(ReportWithoutFrontLoading.INSTANCE)) - { - Assert.AreEqual(typeof(MethodLevelReporter), Approvals.GetReporter().GetType()); - } - } - - [Test] - [UseReporter(typeof(MethodLevelReporter))] - public async Task TestAsyncMethodOverride() - { - await Task.Delay(1); - using (Approvals.SetFrontLoadedReporter(ReportWithoutFrontLoading.INSTANCE)) - { - Assert.AreEqual(typeof(MethodLevelReporter), Approvals.GetReporter().GetType()); - } - } - - [Test] - [UseReporter(typeof(MethodLevelReporter))] - public void TestMethodOverrideWithSubMethod() - { - using (Approvals.SetFrontLoadedReporter(ReportWithoutFrontLoading.INSTANCE)) - { - SubMethod(); - } - } - - [Test] - [UseReporter(typeof(MethodLevelReporter), typeof(ClassLevelReporter))] - public void TestMultipleReporters() - { - using (Approvals.SetFrontLoadedReporter(ReportWithoutFrontLoading.INSTANCE)) - { - Assert.AreEqual(typeof(MultiReporter), Approvals.GetReporter().GetType()); - } - } - - [Test] - public void TestSingletonOnAllReporters() - { - using (Approvals.SetFrontLoadedReporter(ReportWithoutFrontLoading.INSTANCE)) - { - var reporters = GetSingletonReporterTypes(); - foreach (var r in reporters) Assert.IsInstanceOf(r, UseReporterAttribute.GetSingleton(r), $"Please add\npublic static readonly {r.FullName} INSTANCE = new {r.FullName}();"); - } - } -} - -public class MethodLevelReporter : IApprovalFailureReporter -{ - public void Report(string approved, string received) - { - } -} - -public class ClassLevelReporter : IApprovalFailureReporter -{ - public void Report(string approved, string received) - { - } -} \ No newline at end of file diff --git a/src/ApprovalTests.NUnit3/Reporters/ReporterTest.TestInvalidReporterShouldThrow.approved.txt b/src/ApprovalTests.NUnit3/Reporters/ReporterTest.TestInvalidReporterShouldThrow.approved.txt deleted file mode 100644 index 9f714c4b..00000000 --- a/src/ApprovalTests.NUnit3/Reporters/ReporterTest.TestInvalidReporterShouldThrow.approved.txt +++ /dev/null @@ -1,9 +0,0 @@ -Invalid configuration of reporter. Reporters must extend IApprovalFailureReporter. -Invalid reporter type: ReporterTest - -Note: The stack here is not helpful. - -Invalid configuration of reporter. Reporters must extend IApprovalFailureReporter. -Invalid reporter type: ReporterTest - -Note: The stack here is not helpful. \ No newline at end of file diff --git a/src/ApprovalTests.NUnit3/Reporters/ReporterTest.TestMultipleWithInvalidReporterShouldThrow.approved.txt b/src/ApprovalTests.NUnit3/Reporters/ReporterTest.TestMultipleWithInvalidReporterShouldThrow.approved.txt deleted file mode 100644 index a674b84b..00000000 --- a/src/ApprovalTests.NUnit3/Reporters/ReporterTest.TestMultipleWithInvalidReporterShouldThrow.approved.txt +++ /dev/null @@ -1,9 +0,0 @@ -Invalid configuration of reporter. Reporters must extend IApprovalFailureReporter. -Invalid reporter type: System.String - -Note: The stack here is not helpful. - -Invalid configuration of reporter. Reporters must extend IApprovalFailureReporter. -Invalid reporter type: ReporterTest - -Note: The stack here is not helpful. \ No newline at end of file diff --git a/src/ApprovalTests.NUnit3/Reporters/ReporterTest.cs b/src/ApprovalTests.NUnit3/Reporters/ReporterTest.cs deleted file mode 100644 index 8a904211..00000000 --- a/src/ApprovalTests.NUnit3/Reporters/ReporterTest.cs +++ /dev/null @@ -1,41 +0,0 @@ -using ApprovalTests.Reporters.ContinuousIntegration; - -[TestFixture] -public class ReporterTest -{ - [Test] - public void Testname() - { - var old = Environment.GetEnvironmentVariable(NCrunchReporter.EnvironmentVariable); - Environment.SetEnvironmentVariable(NCrunchReporter.EnvironmentVariable, "1"); - Assert.IsTrue(NCrunchReporter.INSTANCE.IsWorkingInThisEnvironment("a.txt")); - Environment.SetEnvironmentVariable(NCrunchReporter.EnvironmentVariable, old); - } - - [Test] - public void TestInvalidReporterShouldThrow() - { - var attribute = new UseReporterAttribute(typeof(ReporterTest)); - VerifyReporterAttribute(attribute); - } - - [Test] - public void TestMultipleWithInvalidReporterShouldThrow() - { - var attribute = new UseReporterAttribute(typeof(ReporterTest), typeof(string)); - VerifyReporterAttribute(attribute); - } - - static void VerifyReporterAttribute(UseReporterAttribute attribute) - { - var reporter = (IEnvironmentAwareReporter) attribute.Reporter; - var reportException = Assert.Throws(() => reporter.Report("a.txt", "a.txt")); - var isWorkingException = Assert.Throws(() => reporter.IsWorkingInThisEnvironment("a.txt")); - - Approvals.Verify($""" - {reportException.Message} - - {isWorkingException.Message} - """); - } -} \ No newline at end of file diff --git a/src/ApprovalTests.NUnit3/Reporters/TortoiseImageDiffTest.TestIsImage.approved.txt b/src/ApprovalTests.NUnit3/Reporters/TortoiseImageDiffTest.TestIsImage.approved.txt deleted file mode 100644 index 94de06af..00000000 --- a/src/ApprovalTests.NUnit3/Reporters/TortoiseImageDiffTest.TestIsImage.approved.txt +++ /dev/null @@ -1,9 +0,0 @@ -image.png => True -image.gif => True -image.jpg => True -image.jpeg => True -image.tif => True -image.tiff => True -movie.avi => False -text.txt => False -excel.xls => False diff --git a/src/ApprovalTests.NUnit3/Reporters/TortoiseImageDiffTest.cs b/src/ApprovalTests.NUnit3/Reporters/TortoiseImageDiffTest.cs deleted file mode 100644 index 47901885..00000000 --- a/src/ApprovalTests.NUnit3/Reporters/TortoiseImageDiffTest.cs +++ /dev/null @@ -1,21 +0,0 @@ -[TestFixture] -public class TortoiseImageDiffTest -{ - [Test] - public void TestIsImage() - { - if (!TortoiseTextDiffReporter.INSTANCE.IsWorkingInThisEnvironment("a.txt")) - { - return; - } - - var files = new[] - { - "image.png", "image.gif", "image.jpg", "image.jpeg", "image.tif", "image.tiff", - "movie.avi", "text.txt", "excel.xls" - }; - Approvals.VerifyAll( - files, - f => $"{f} => {TortoiseImageDiffReporter.INSTANCE.IsWorkingInThisEnvironment(f)}"); - } -} \ No newline at end of file diff --git a/src/ApprovalTests.NUnit3/UnixLineEndings.txt b/src/ApprovalTests.NUnit3/UnixLineEndings.txt deleted file mode 100644 index bab18e64..00000000 --- a/src/ApprovalTests.NUnit3/UnixLineEndings.txt +++ /dev/null @@ -1,2 +0,0 @@ -Foo -Bar \ No newline at end of file diff --git a/src/ApprovalTests.NUnit3/WindowsLineEndings.txt b/src/ApprovalTests.NUnit3/WindowsLineEndings.txt deleted file mode 100644 index bab18e64..00000000 --- a/src/ApprovalTests.NUnit3/WindowsLineEndings.txt +++ /dev/null @@ -1,2 +0,0 @@ -Foo -Bar \ No newline at end of file