Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed May 11, 2024
1 parent ec82c82 commit 9a2059e
Show file tree
Hide file tree
Showing 89 changed files with 76 additions and 257 deletions.
7 changes: 2 additions & 5 deletions docs/ApprovalTests/Reporters.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ Extend `IApprovalFailureReporter`. For example a file can be launched on failure
<!-- snippet: FileLauncherReporter.cs -->
<a id='snippet-FileLauncherReporter.cs'></a>
```cs
using System.Diagnostics;
using ApprovalTests.Core;

namespace ApprovalTests.Reporters;

public class FileLauncherReporter : IApprovalFailureReporter
Expand All @@ -58,7 +55,7 @@ public class FileLauncherReporter : IApprovalFailureReporter
}
}
```
<sup><a href='/src/ApprovalTests/Reporters/FileLauncherReporter.cs#L1-L15' title='Snippet source file'>snippet source</a> | <a href='#snippet-FileLauncherReporter.cs' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/ApprovalTests/Reporters/FileLauncherReporter.cs#L1-L12' title='Snippet source file'>snippet source</a> | <a href='#snippet-FileLauncherReporter.cs' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand Down Expand Up @@ -101,7 +98,7 @@ MyGetReporter.INSTANCE,
GoContinuousDeliveryReporter.INSTANCE,
AppVeyorReporter.INSTANCE
```
<sup><a href='/src/ApprovalTests/Reporters/DefaultFrontLoaderReporter.cs#L11-L21' title='Snippet source file'>snippet source</a> | <a href='#snippet-continuous_integration' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/ApprovalTests/Reporters/DefaultFrontLoaderReporter.cs#L9-L19' title='Snippet source file'>snippet source</a> | <a href='#snippet-continuous_integration' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

You can add to this by configuring the FrontLoadedReporter Annotation.
Expand Down
4 changes: 2 additions & 2 deletions docs/ApprovalTests/explanations/MainConcepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ Eventually, all Verify methods call:
```cs
public static void Verify(IApprovalWriter writer, IApprovalNamer namer, IApprovalFailureReporter reporter)
```
<sup><a href='/src/ApprovalTests/Approvals.cs#L38-L40' title='Snippet source file'>snippet source</a> | <a href='#snippet-complete_verify_call' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/ApprovalTests/Approvals.cs#L31-L33' title='Snippet source file'>snippet source</a> | <a href='#snippet-complete_verify_call' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Most of the time this is hidden in an underlying a Verify call.
Expand All @@ -143,7 +143,7 @@ If you simply wanted to format text this is usually done in a separate step befo
```cs
public static void VerifyWithExtension(string text, string fileExtensionWithDot, Func<string, string> scrubber = null)
```
<sup><a href='/src/ApprovalTests/Approvals.cs#L141-L143' title='Snippet source file'>snippet source</a> | <a href='#snippet-verify_with_extension' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/ApprovalTests/Approvals.cs#L134-L136' title='Snippet source file'>snippet source</a> | <a href='#snippet-verify_with_extension' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand Down
2 changes: 1 addition & 1 deletion docs/ApprovalUtilities/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Guards are convenient functions if incorrect values are passed in.
```cs
Guard.AgainstNullAndEmpty(subdirectory, nameof(subdirectory));
```
<sup><a href='/src/ApprovalTests/Namers/UseApprovalSubdirectoryAttribute.cs#L9-L11' title='Snippet source file'>snippet source</a> | <a href='#snippet-guard_usage' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/ApprovalTests/Namers/UseApprovalSubdirectoryAttribute.cs#L7-L9' title='Snippet source file'>snippet source</a> | <a href='#snippet-guard_usage' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand Down
11 changes: 2 additions & 9 deletions src/ApprovalTests/AlwaysWorksReporter.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
using ApprovalTests.Core;

class AlwaysWorksReporter : IEnvironmentAwareReporter
class AlwaysWorksReporter(IApprovalFailureReporter reporter) :
IEnvironmentAwareReporter
{
readonly IApprovalFailureReporter reporter;

public AlwaysWorksReporter(IApprovalFailureReporter reporter) =>
this.reporter = reporter;


public void Report(string approved, string received) =>
reporter.Report(approved, received);

Expand Down
7 changes: 0 additions & 7 deletions src/ApprovalTests/Approvals.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
using ApprovalTests.Approvers;
using ApprovalTests.Core;
using ApprovalTests.Html;
using ApprovalTests.Namers;
using ApprovalTests.Reporters;
using ApprovalTests.Scrubber;
using ApprovalTests.Utilities;
using ApprovalTests.Writers;
using ApprovalTests.Xml;
using ApprovalUtilities.CallStack;
using ApprovalUtilities.Persistence;
using ApprovalUtilities.Utilities;

namespace ApprovalTests;

Expand Down
1 change: 0 additions & 1 deletion src/ApprovalTests/Approvers/FileApprover.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using ApprovalTests.Core;
using ApprovalTests.Core.Exceptions;
using EmptyFiles;

Expand Down
1 change: 0 additions & 1 deletion src/ApprovalTests/Combinations/CombinationApprovals.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Globalization;
using System.Text;

namespace ApprovalTests.Combinations;

Expand Down
2 changes: 0 additions & 2 deletions src/ApprovalTests/Email/EmailApprovals.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Net.Mail;
using ApprovalTests.Scrubber;
using ApprovalTests.Writers;

namespace ApprovalTests.Email;

Expand Down
3 changes: 1 addition & 2 deletions src/ApprovalTests/Events/EventApprovals.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Text;
using ApprovalUtilities.Reflection;
using ApprovalUtilities.Reflection;

namespace ApprovalTests.Events;

Expand Down
2 changes: 0 additions & 2 deletions src/ApprovalTests/ExceptionalExceptions/ExceptionalId.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using ApprovalUtilities.Utilities;

namespace ApprovalTests.ExceptionalExceptions;

public class ExceptionalId
Expand Down
19 changes: 19 additions & 0 deletions src/ApprovalTests/GlobalUsings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Global using directives

global using System.Collections.Concurrent;
global using System.Diagnostics;
global using System.Text;
global using System.Text.RegularExpressions;
global using ApprovalTests.Core;
global using ApprovalTests.Namers;
global using ApprovalTests.Reporters;
global using ApprovalTests.Reporters.ContinuousIntegration;
global using ApprovalTests.Scrubber;
global using ApprovalTests.StackTraceParsers;
global using ApprovalTests.Utilities;
global using ApprovalTests.Writers;
global using ApprovalUtilities.Utilities;
global using ApprovalUtilities.Xml;
global using DiffEngine;
global using Microsoft.Win32;
global using TextCopy;
1 change: 0 additions & 1 deletion src/ApprovalTests/Maintenance/ApprovalMaintenance.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Reflection;
using ApprovalUtilities.CallStack;
using ApprovalUtilities.Utilities;

namespace ApprovalTests.Maintenance;

Expand Down
2 changes: 0 additions & 2 deletions src/ApprovalTests/Namers/ApprovalResults.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using ApprovalUtilities.Utilities;

namespace ApprovalTests.Namers;

public static class ApprovalResults
Expand Down
4 changes: 1 addition & 3 deletions src/ApprovalTests/Namers/ApprovalsFilename.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using ApprovalUtilities.Utilities;

namespace ApprovalTests.Namers;
namespace ApprovalTests.Namers;

public class ApprovalsFilename
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System.Diagnostics;
using ApprovalUtilities.CallStack;

namespace ApprovalTests.Namers.StackTraceParsers;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using System.Diagnostics;

namespace ApprovalTests.Namers.StackTraceParsers;

public interface IStackTraceParser
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using ApprovalTests.StackTraceParsers;
using ApprovalUtilities.Utilities;
using System.Diagnostics;
using ApprovalTests.Namers.UnitTestFrameworks;

namespace ApprovalTests.Namers.StackTraceParsers;
Expand Down
1 change: 0 additions & 1 deletion src/ApprovalTests/Namers/UnitTestFrameworkNamer.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using ApprovalTests.Core;
using ApprovalTests.Namers.StackTraceParsers;

namespace ApprovalTests.Namers;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System.Diagnostics;
using System.Reflection;
using ApprovalTests.Namers.StackTraceParsers;
using ApprovalUtilities.CallStack;
Expand Down
2 changes: 0 additions & 2 deletions src/ApprovalTests/Namers/UseApprovalSubdirectoryAttribute.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using ApprovalUtilities.Utilities;

namespace ApprovalTests.Namers;

public class UseApprovalSubdirectoryAttribute : Attribute
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System.Text;
using ApprovalTests.Core;
using TextCopy;

namespace ApprovalTests.Reporters;
namespace ApprovalTests.Reporters;

public class AllFailingTestsClipboardReporter : IApprovalFailureReporter
{
Expand Down
3 changes: 0 additions & 3 deletions src/ApprovalTests/Reporters/ClipboardReporter.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using ApprovalTests.Core;
using TextCopy;

namespace ApprovalTests.Reporters;

public class ClipboardReporter : IApprovalFailureReporter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using ApprovalTests.Core;

namespace ApprovalTests.Reporters.ContinuousIntegration;

public class AppVeyorReporter : IEnvironmentAwareReporter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using ApprovalTests.Core;

namespace ApprovalTests.Reporters.ContinuousIntegration;
namespace ApprovalTests.Reporters.ContinuousIntegration;

public class BambooReporter : IEnvironmentAwareReporter
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using ApprovalTests.Core;

namespace ApprovalTests.Reporters.ContinuousIntegration;

public class GoContinuousDeliveryReporter : IEnvironmentAwareReporter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using ApprovalTests.Core;

namespace ApprovalTests.Reporters.ContinuousIntegration;
namespace ApprovalTests.Reporters.ContinuousIntegration;

public class JenkinsReporter : IEnvironmentAwareReporter
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using ApprovalTests.Core;

namespace ApprovalTests.Reporters.ContinuousIntegration;
namespace ApprovalTests.Reporters.ContinuousIntegration;

public class MyGetReporter : IEnvironmentAwareReporter
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using ApprovalTests.Core;

namespace ApprovalTests.Reporters.ContinuousIntegration;
namespace ApprovalTests.Reporters.ContinuousIntegration;

public class NCrunchReporter : IEnvironmentAwareReporter
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using ApprovalTests.Core;

namespace ApprovalTests.Reporters.ContinuousIntegration;
namespace ApprovalTests.Reporters.ContinuousIntegration;

public class TeamCityReporter : IEnvironmentAwareReporter
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using ApprovalTests.Core;
using ApprovalTests.Utilities;

namespace ApprovalTests.Reporters.ContinuousIntegration;
namespace ApprovalTests.Reporters.ContinuousIntegration;

public class TfsReporter : IEnvironmentAwareReporter
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using ApprovalTests.Core;

namespace ApprovalTests.Reporters.ContinuousIntegration;

public class TfsVnextReporter : IEnvironmentAwareReporter
Expand Down
4 changes: 1 addition & 3 deletions src/ApprovalTests/Reporters/DefaultFrontLoaderReporter.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using ApprovalTests.Reporters.ContinuousIntegration;

namespace ApprovalTests.Reporters;
namespace ApprovalTests.Reporters;

public class DefaultFrontLoaderReporter : FirstWorkingReporter
{
Expand Down
5 changes: 1 addition & 4 deletions src/ApprovalTests/Reporters/DiffReporter.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using ApprovalTests.Core;
using DiffEngine;

namespace ApprovalTests.Reporters;
namespace ApprovalTests.Reporters;

public class DiffReporter : IEnvironmentAwareReporter
{
Expand Down
3 changes: 0 additions & 3 deletions src/ApprovalTests/Reporters/DiffToolReporter.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using ApprovalTests.Core;
using DiffEngine;

namespace ApprovalTests.Reporters;

public class DiffToolReporter(DiffTool diffTool) : IEnvironmentAwareReporter
Expand Down
1 change: 0 additions & 1 deletion src/ApprovalTests/Reporters/ExecutableQueryFailure.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using ApprovalTests.Core;
using ApprovalUtilities.Persistence;

namespace ApprovalTests.Reporters;
Expand Down
3 changes: 0 additions & 3 deletions src/ApprovalTests/Reporters/FileLauncherReporter.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using System.Diagnostics;
using ApprovalTests.Core;

namespace ApprovalTests.Reporters;

public class FileLauncherReporter : IApprovalFailureReporter
Expand Down
5 changes: 1 addition & 4 deletions src/ApprovalTests/Reporters/FileLauncherWithDelayReporter.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using ApprovalTests.Core;
using ApprovalTests.Reporters;

public class FileLauncherWithDelayReporter(int seconds = 2) :
public class FileLauncherWithDelayReporter(int seconds = 2) :
IApprovalFailureReporter
{
public static readonly FileLauncherWithDelayReporter INSTANCE = new();
Expand Down
2 changes: 0 additions & 2 deletions src/ApprovalTests/Reporters/FirstWorkingReporter.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using ApprovalTests.Core;

namespace ApprovalTests.Reporters;

public class FirstWorkingReporter(IEnumerable<IEnvironmentAwareReporter> reporters) :
Expand Down
2 changes: 0 additions & 2 deletions src/ApprovalTests/Reporters/FrontLoadedReporterAttribute.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using ApprovalTests.Core;

namespace ApprovalTests.Reporters;

[AttributeUsage(AttributeTargets.Assembly)]
Expand Down
2 changes: 0 additions & 2 deletions src/ApprovalTests/Reporters/FrontLoadedReporterDisposer.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using ApprovalTests.Core;

namespace ApprovalTests.Reporters;

public class FrontLoadedReporterDisposer : IDisposable
Expand Down
4 changes: 0 additions & 4 deletions src/ApprovalTests/Reporters/InlineTextReporter.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
using ApprovalTests.Core;
using ApprovalUtilities.Utilities;
using TextCopy;

namespace ApprovalTests.Reporters;

public class InlineTextReporter : IApprovalFailureReporter
Expand Down
5 changes: 1 addition & 4 deletions src/ApprovalTests/Reporters/IntroductionReporter.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System.Diagnostics;
using ApprovalTests.Core;

namespace ApprovalTests.Reporters;
namespace ApprovalTests.Reporters;

public class IntroductionReporter : IApprovalFailureReporter
{
Expand Down
2 changes: 0 additions & 2 deletions src/ApprovalTests/Reporters/InvalidReporterConfiguration.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using ApprovalTests.Core;

namespace ApprovalTests.Reporters;

public class InvalidReporterConfiguration(Type reporter) :
Expand Down
6 changes: 1 addition & 5 deletions src/ApprovalTests/Reporters/MachineSpecificReporter.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System.Text;
using ApprovalTests.Core;
using ApprovalTests.Namers;

namespace ApprovalTests.Reporters;
namespace ApprovalTests.Reporters;

public class MachineSpecificReporter : IEnvironmentAwareReporter
{
Expand Down
2 changes: 0 additions & 2 deletions src/ApprovalTests/Reporters/MultiReporter.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using ApprovalTests.Core;

namespace ApprovalTests.Reporters;

public class MultiReporter : IEnvironmentAwareReporter, IApprovalReporterWithCleanUp
Expand Down
3 changes: 0 additions & 3 deletions src/ApprovalTests/Reporters/PowershellClipboardReporter.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using ApprovalTests.Core;
using TextCopy;

namespace ApprovalTests.Reporters;

public class PowerShellClipboardReporter : IApprovalFailureReporter
Expand Down
2 changes: 0 additions & 2 deletions src/ApprovalTests/Reporters/QuietReporter.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Diagnostics;
using System.Runtime.InteropServices;
using ApprovalTests.Core;

namespace ApprovalTests.Reporters;

Expand Down

0 comments on commit 9a2059e

Please sign in to comment.