Skip to content

Commit ef0153e

Browse files
committed
dont diff or clipboard if ncrunch
1 parent 7fdaf25 commit ef0153e

File tree

6 files changed

+49
-13
lines changed

6 files changed

+49
-13
lines changed

Diff for: src/Directory.Build.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Project>
33
<PropertyGroup>
44
<NoWarn>CS1591;CS0649</NoWarn>
5-
<Version>1.11.1</Version>
5+
<Version>1.11.2</Version>
66
<PackageTags>Json, Testing, Verify</PackageTags>
77
<Description>Enables simple verification of complex models and documents.</Description>
88
</PropertyGroup>

Diff for: src/Verify.Tests/VerifySettingsTests.cs

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using System.Linq;
3-
using System.Threading.Tasks;
43
using Verify;
54
using VerifyXunit;
65
using Xunit;
@@ -13,21 +12,22 @@ public class VerifySettingsTests :
1312
public void DataIsCloned()
1413
{
1514
var originalSettings = new VerifySettings();
16-
originalSettings.Data.Add("clonable", new MyClonable());
15+
originalSettings.Data.Add("cloneable", new MyCloneable());
1716
var newSettings = new VerifySettings(originalSettings);
1817
Assert.NotSame(originalSettings.Data.Single().Value, newSettings.Data.Single().Value);
1918
}
2019

21-
public VerifySettingsTests(ITestOutputHelper output) :
22-
base(output)
23-
{
24-
}
25-
26-
public class MyClonable : ICloneable
20+
class MyCloneable :
21+
ICloneable
2722
{
2823
public object Clone()
2924
{
30-
return new MyClonable();
25+
return new MyCloneable();
3126
}
3227
}
28+
29+
public VerifySettingsTests(ITestOutputHelper output) :
30+
base(output)
31+
{
32+
}
3333
}

Diff for: src/Verify/Clipboard/NCrunch.cs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using System;
2+
3+
static class NCrunch
4+
{
5+
public static bool Enabled()
6+
{
7+
return Environment.GetEnvironmentVariable("NCrunch") == "1";
8+
}
9+
}

Diff for: src/Verify/Clipboard/VerifySettings.cs

+15-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,21 @@
22
{
33
public partial class VerifySettings
44
{
5-
internal bool clipboardEnabled = true;
5+
internal bool clipboardEnabled = ShouldEnableClipboard();
6+
7+
static bool ShouldEnableClipboard()
8+
{
9+
if (NCrunch.Enabled())
10+
{
11+
return false;
12+
}
13+
14+
if (BuildServerDetector.Detected)
15+
{
16+
return false;
17+
}
18+
return true;
19+
}
620

721
public void DisableClipboard()
822
{

Diff for: src/Verify/DiffTool/VerifySettings.cs

+14-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,20 @@
22
{
33
public partial class VerifySettings
44
{
5-
internal bool diffEnabled = true;
5+
internal bool diffEnabled = ShouldEnableDiff();
6+
7+
static bool ShouldEnableDiff()
8+
{
9+
if (NCrunch.Enabled())
10+
{
11+
return false;
12+
}
13+
if (BuildServerDetector.Detected)
14+
{
15+
return false;
16+
}
17+
return true;
18+
}
619

720
public void DisableDiff()
821
{

Diff for: src/Verify/Verifier/VerifyEngine.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public async Task ThrowIfRequired(string? message = null)
7070
builder.AppendLine(message);
7171
}
7272

73-
if (!BuildServerDetector.Detected && settings.clipboardEnabled && !settings.autoVerify)
73+
if (settings.clipboardEnabled && !settings.autoVerify)
7474
{
7575
builder.AppendLine("Verify command placed in clipboard.");
7676
}

0 commit comments

Comments
 (0)