Skip to content

Commit

Permalink
remove instance based clipboard settings
Browse files Browse the repository at this point in the history
fixes #304
  • Loading branch information
SimonCropp committed Feb 14, 2021
1 parent f063dec commit 9002e25
Show file tree
Hide file tree
Showing 11 changed files with 4 additions and 77 deletions.
2 changes: 1 addition & 1 deletion docs/build-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,5 @@ if (BuildServerDetector.Detected)
});
}
```
<sup><a href='/src/Verify.Tests/Snippets/Snippets.cs#L99-L113' title='Snippet source file'>snippet source</a> | <a href='#snippet-derivepathinfoappveyor' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Snippets/Snippets.cs#L79-L93' title='Snippet source file'>snippet source</a> | <a href='#snippet-derivepathinfoappveyor' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->
12 changes: 0 additions & 12 deletions docs/mdsource/clipboard.source.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,8 @@ Add a variable named `Verify.DeleteCommand` where `{0}` will be replaced with th

The clipboard behavior can be disable using the following:


### Per Test

snippet: DisableClipboard


### For all tests

snippet: DisableClipboardGlobal

If clipboard is disabled for all tests, it can be re-enabled at the test level:

snippet: EnableClipboard


### For a machine

Expand Down
3 changes: 1 addition & 2 deletions src/Verify.DerivePaths.Tests/Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ static Task Run()
{
return Verifier.Verify("Value")
.UseMethodName("Conflict")
.DisableDiff()
.DisableClipboard();
.DisableDiff();
}

try
Expand Down
2 changes: 0 additions & 2 deletions src/Verify.Tests/Comparer/ComparerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public async Task Instance_with_message()
VerifySettings settings = new();
settings.UseStringComparer(CompareWithMessage);
settings.DisableDiff();
settings.DisableClipboard();
var exception = await Assert.ThrowsAsync<Exception>(() => Verifier.Verify("NotTheText", settings));
Assert.Contains("theMessage", exception.Message);
}
Expand All @@ -37,7 +36,6 @@ public async Task Static_with_message()
VerifySettings settings = new();
settings.UseExtension("staticComparerExtMessage");
settings.DisableDiff();
settings.DisableClipboard();
var exception = await Assert.ThrowsAsync<Exception>(() => Verifier.Verify("TheText", settings));
Assert.Equal(
@"Results do not match.
Expand Down
20 changes: 0 additions & 20 deletions src/Verify.Tests/Snippets/Snippets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,6 @@ public async Task OnHandlersSample()

#endregion

void DisableClipboard()
{
#region DisableClipboard

VerifySettings settings = new();
settings.DisableClipboard();

#endregion
}

void TreatAsString()
{
#region TreatAsString
Expand All @@ -59,16 +49,6 @@ class ClassWithToString
public string Property { get; set; } = null!;
}

void EnableClipboard()
{
#region EnableClipboard

VerifySettings settings = new();
settings.EnableClipboard();

#endregion
}

void DisableClipboardGlobal()
{
#region DisableClipboardGlobal
Expand Down
3 changes: 0 additions & 3 deletions src/Verify.Tests/Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ public async Task OnVerifyMismatch()
{
VerifySettings settings = new();
settings.DisableDiff();
settings.DisableClipboard();
var onFirstVerifyCalled = false;
var onVerifyMismatchCalled = false;
VerifierSettings.OnFirstVerify(
Expand Down Expand Up @@ -169,7 +168,6 @@ public async Task OnFirstVerify()
{
VerifySettings settings = new();
settings.DisableDiff();
settings.DisableClipboard();
var onFirstVerifyCalled = false;
var onVerifyMismatchCalled = false;
VerifierSettings.OnFirstVerify(
Expand Down Expand Up @@ -379,7 +377,6 @@ public async Task ShouldNotIgnoreCase()
{
await Verifier.Verify("A");
VerifySettings settings = new();
settings.DisableClipboard();
settings.DisableDiff();
await Assert.ThrowsAsync<Exception>(() => Verifier.Verify("a", settings));
}
Expand Down
7 changes: 1 addition & 6 deletions src/Verify/Clipboard/ClipboardEnabled.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ public static bool IsEnabled(VerifySettings settings)
return false;
}

if (settings.clipboardEnabled == null)
{
return !VerifierSettings.clipboardDisabled;
}

return settings.clipboardEnabled.Value;
return !VerifierSettings.clipboardDisabled;
}
}
17 changes: 0 additions & 17 deletions src/Verify/Clipboard/VerifySettings.cs

This file was deleted.

12 changes: 0 additions & 12 deletions src/Verify/SettingsTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,6 @@ public SettingsTask ScrubInlineGuids()
return this;
}

public SettingsTask DisableClipboard()
{
CurrentSettings.DisableClipboard();
return this;
}

public SettingsTask EnableClipboard()
{
CurrentSettings.EnableClipboard();
return this;
}

public SettingsTask UseStreamComparer(StreamCompare compare)
{
CurrentSettings.UseStreamComparer(compare);
Expand Down
2 changes: 1 addition & 1 deletion src/Verify/Verifier/VerifyEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public async Task HandleResults(List<ResultBuilder> results)
}
}

public void HandleCompareResult(EqualityResult compareResult, in FilePair file)
void HandleCompareResult(EqualityResult compareResult, in FilePair file)
{
switch (compareResult.Equality)
{
Expand Down
1 change: 0 additions & 1 deletion src/Verify/VerifySettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public VerifySettings(VerifySettings? settings)

instanceScrubbers = new(settings.instanceScrubbers);
extension = settings.extension;
clipboardEnabled = settings.clipboardEnabled;
diffEnabled = settings.diffEnabled;
methodName = settings.methodName;
typeName = settings.typeName;
Expand Down

0 comments on commit 9002e25

Please sign in to comment.