diff --git a/Build/_build.csproj b/Build/_build.csproj
index ba171562..3d7812d3 100644
--- a/Build/_build.csproj
+++ b/Build/_build.csproj
@@ -10,7 +10,7 @@
-
+
diff --git a/Build/_build.csproj.DotSettings b/Build/_build.csproj.DotSettings
index 7bc28484..03060223 100644
--- a/Build/_build.csproj.DotSettings
+++ b/Build/_build.csproj.DotSettings
@@ -16,6 +16,8 @@
False
<Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
<Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+ <Policy><Descriptor Staticness="Instance" AccessRightKinds="Private" Description="Instance fields (private)"><ElementKinds><Kind Name="FIELD" /><Kind Name="READONLY_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" WarnAboutPrefixesAndSuffixes="False" Prefix="" Suffix="" Style="AaBb" /></Policy>
+ <Policy><Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static fields (private)"><ElementKinds><Kind Name="FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" WarnAboutPrefixesAndSuffixes="False" Prefix="" Suffix="" Style="AaBb" /></Policy>
True
True
True
@@ -24,4 +26,5 @@
True
True
True
- True
+ True
+ True
diff --git a/FluentAssertions.Json.sln.DotSettings b/FluentAssertions.Json.sln.DotSettings
index d0c4c588..aaeb82d0 100644
--- a/FluentAssertions.Json.sln.DotSettings
+++ b/FluentAssertions.Json.sln.DotSettings
@@ -18,6 +18,8 @@
False
<Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
<Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy><Descriptor Staticness="Instance" AccessRightKinds="Private" Description="Instance fields (private)"><ElementKinds><Kind Name="FIELD" /><Kind Name="READONLY_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" WarnAboutPrefixesAndSuffixes="False" Prefix="" Suffix="" Style="aaBb" /></Policy>
+ <Policy><Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static fields (private)"><ElementKinds><Kind Name="FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" WarnAboutPrefixesAndSuffixes="False" Prefix="" Suffix="" Style="aaBb" /></Policy>
<Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
<Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
<Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
@@ -67,6 +69,7 @@
True
True
True
+ True
D:\Workspaces\FluentAssertions\Default.testsettings
4
False
diff --git a/Src/FluentAssertions.Json/FluentAssertions.Json.csproj b/Src/FluentAssertions.Json/FluentAssertions.Json.csproj
index 95b753af..3620b34e 100644
--- a/Src/FluentAssertions.Json/FluentAssertions.Json.csproj
+++ b/Src/FluentAssertions.Json/FluentAssertions.Json.csproj
@@ -26,16 +26,16 @@
Apache-2.0
FluentAssertions.png
See https://github.com/fluentassertions/fluentassertions.json/releases/
- Copyright Dennis Doomen 2010-2021
+ Copyright 2024-$([System.DateTime]::Now.ToString(yyyy)) Xceed Software Inc., all rights reserved
9.0
false
-
-
-
+
+
+
@@ -46,11 +46,11 @@
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
@@ -58,7 +58,7 @@
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/Src/FluentAssertions.Json/JTokenAssertions.cs b/Src/FluentAssertions.Json/JTokenAssertions.cs
index 9f956cb4..19f82151 100644
--- a/Src/FluentAssertions.Json/JTokenAssertions.cs
+++ b/Src/FluentAssertions.Json/JTokenAssertions.cs
@@ -27,10 +27,11 @@ static JTokenAssertions()
/// Initializes a new instance of the class.
///
/// The subject
- public JTokenAssertions(JToken subject)
- : base(subject)
+ ///
+ public JTokenAssertions(JToken subject, AssertionChain assertionChain)
+ : base(subject, assertionChain)
{
- EnumerableSubject = new GenericCollectionAssertions(subject);
+ EnumerableSubject = new GenericCollectionAssertions(subject, assertionChain);
}
///
@@ -126,7 +127,7 @@ private AndConstraint BeEquivalentTo(JToken expected, bool ign
$"{Format(expected, true).EscapePlaceholders()}{Environment.NewLine}" +
"{reason}.";
- Execute.Assertion
+ CurrentAssertionChain
.ForCondition(difference == null)
.BecauseOf(because, becauseArgs)
.FailWith(message);
@@ -180,7 +181,7 @@ public AndConstraint NotBeEquivalentTo(string unexpected, stri
///
public AndConstraint NotBeEquivalentTo(JToken unexpected, string because = "", params object[] becauseArgs)
{
- Execute.Assertion
+ CurrentAssertionChain
.ForCondition((Subject is null && unexpected is not null) ||
!JToken.DeepEquals(Subject, unexpected))
.BecauseOf(because, becauseArgs)
@@ -211,12 +212,12 @@ public AndConstraint HaveValue(string expected)
///
public AndConstraint HaveValue(string expected, string because, params object[] becauseArgs)
{
- Execute.Assertion
+ CurrentAssertionChain
.ForCondition(Subject is not null)
.BecauseOf(because, becauseArgs)
.FailWith("Expected JSON token to have value {0}, but the element was .", expected);
- Execute.Assertion
+ CurrentAssertionChain
.ForCondition(Subject.Value() == expected)
.BecauseOf(because, becauseArgs)
.FailWith("Expected JSON property {0} to have value {1}{reason}, but found {2}.",
@@ -238,12 +239,12 @@ public AndConstraint HaveValue(string expected, string because
///
public AndConstraint NotHaveValue(string unexpected, string because = "", params object[] becauseArgs)
{
- Execute.Assertion
+ CurrentAssertionChain
.ForCondition(Subject is not null)
.BecauseOf(because, becauseArgs)
.FailWith("Did not expect the JSON property to have value {0}, but the token was .", unexpected);
- Execute.Assertion
+ CurrentAssertionChain
.ForCondition(Subject.Value() != unexpected)
.BecauseOf(because, becauseArgs)
.FailWith("Did not expect JSON property {0} to have value {1}{reason}.",
@@ -279,7 +280,7 @@ public AndConstraint MatchRegex(string regularExpression, stri
throw new ArgumentNullException(nameof(regularExpression), "MatchRegex does not support pattern");
}
- Execute.Assertion
+ CurrentAssertionChain
.ForCondition(Regex.IsMatch(Subject.Value(), regularExpression))
.BecauseOf(because, becauseArgs)
.FailWith("Expected {context:JSON property} {0} to match regex pattern {1}{reason}, but found {2}.",
@@ -306,7 +307,7 @@ public AndConstraint NotMatchRegex(string regularExpression, s
throw new ArgumentNullException(nameof(regularExpression), "MatchRegex does not support pattern");
}
- Execute.Assertion
+ CurrentAssertionChain
.ForCondition(!Regex.IsMatch(Subject.Value(), regularExpression))
.BecauseOf(because, becauseArgs)
.FailWith("Did not expect {context:JSON property} {0} to match regex pattern {1}{reason}.",
@@ -341,7 +342,8 @@ public AndWhichConstraint HaveElement(string expected,
params object[] becauseArgs)
{
JToken jToken = Subject[expected];
- Execute.Assertion
+
+ CurrentAssertionChain
.ForCondition(jToken != null)
.BecauseOf(because, becauseArgs)
.FailWith("Expected JSON document {0} to have element \"" + expected.EscapePlaceholders() + "\"{reason}" +
@@ -366,7 +368,8 @@ public AndWhichConstraint NotHaveElement(string unexpe
params object[] becauseArgs)
{
JToken jToken = Subject[unexpected];
- Execute.Assertion
+
+ CurrentAssertionChain
.ForCondition(jToken == null)
.BecauseOf(because, becauseArgs)
.FailWith("Did not expect JSON document {0} to have element \"" + unexpected.EscapePlaceholders() + "\"{reason}.", Subject);
diff --git a/Src/FluentAssertions.Json/JsonAssertionExtensions.cs b/Src/FluentAssertions.Json/JsonAssertionExtensions.cs
index da455331..0e5f0616 100644
--- a/Src/FluentAssertions.Json/JsonAssertionExtensions.cs
+++ b/Src/FluentAssertions.Json/JsonAssertionExtensions.cs
@@ -1,4 +1,5 @@
using System.Diagnostics;
+using FluentAssertions.Execution;
using JetBrains.Annotations;
using Newtonsoft.Json.Linq;
@@ -16,7 +17,7 @@ public static class JsonAssertionExtensions
[Pure]
public static JTokenAssertions Should(this JToken jToken)
{
- return new JTokenAssertions(jToken);
+ return new JTokenAssertions(jToken, AssertionChain.GetOrCreate());
}
///
@@ -25,7 +26,7 @@ public static JTokenAssertions Should(this JToken jToken)
[Pure]
public static JTokenAssertions Should(this JObject jObject)
{
- return new JTokenAssertions(jObject);
+ return new JTokenAssertions(jObject, AssertionChain.GetOrCreate());
}
///
@@ -34,7 +35,7 @@ public static JTokenAssertions Should(this JObject jObject)
[Pure]
public static JTokenAssertions Should(this JValue jValue)
{
- return new JTokenAssertions(jValue);
+ return new JTokenAssertions(jValue, AssertionChain.GetOrCreate());
}
}
}
diff --git a/Src/FluentAssertions.Json/JsonAssertionOptions.cs b/Src/FluentAssertions.Json/JsonAssertionOptions.cs
index f51a5454..a331127a 100644
--- a/Src/FluentAssertions.Json/JsonAssertionOptions.cs
+++ b/Src/FluentAssertions.Json/JsonAssertionOptions.cs
@@ -6,9 +6,9 @@ namespace FluentAssertions.Json
///
/// Represents the run-time type-specific behavior of a JSON structural equivalency assertion. It is the equivalent of
///
- public sealed class JsonAssertionOptions : EquivalencyAssertionOptions, IJsonAssertionOptions
+ public sealed class JsonAssertionOptions : EquivalencyOptions, IJsonAssertionOptions
{
- public JsonAssertionOptions(EquivalencyAssertionOptions equivalencyAssertionOptions) : base(equivalencyAssertionOptions)
+ public JsonAssertionOptions(EquivalencyOptions equivalencyAssertionOptions) : base(equivalencyAssertionOptions)
{
}
diff --git a/Src/FluentAssertions.Json/ObjectAssertionsExtensions.cs b/Src/FluentAssertions.Json/ObjectAssertionsExtensions.cs
index d5ba24e1..01016caa 100644
--- a/Src/FluentAssertions.Json/ObjectAssertionsExtensions.cs
+++ b/Src/FluentAssertions.Json/ObjectAssertionsExtensions.cs
@@ -61,13 +61,13 @@ public static AndConstraint BeJsonSerializable(this ObjectA
/// Zero or more objects to format using the placeholders in .
///
[CustomAssertion]
- public static AndConstraint BeJsonSerializable(this ObjectAssertions assertions, Func, EquivalencyAssertionOptions> options, string because = "", params object[] becauseArgs)
+ public static AndConstraint BeJsonSerializable(this ObjectAssertions assertions, Func, EquivalencyOptions> options, string because = "", params object[] becauseArgs)
{
- Execute.Assertion.ForCondition(assertions.Subject != null)
+ assertions.CurrentAssertionChain.ForCondition(assertions.Subject != null)
.BecauseOf(because, becauseArgs)
.FailWith("Expected {context:object} to be JSON serializable{reason}, but the value is null. Please provide a value for the assertion.");
- Execute.Assertion.ForCondition(assertions.Subject is T)
+ assertions.CurrentAssertionChain.ForCondition(assertions.Subject is T)
.BecauseOf(because, becauseArgs)
.FailWith("Expected {context:object} to be JSON serializable{reason}, but {context:object} is not assignable to {0}", typeof(T));
@@ -75,8 +75,8 @@ public static AndConstraint BeJsonSerializable(this ObjectA
{
var deserializedObject = CreateCloneUsingJsonSerializer(assertions.Subject);
- var defaultOptions = AssertionOptions.CloneDefaults()
- .RespectingRuntimeTypes()
+ var defaultOptions = AssertionConfiguration.Current.Equivalency.CloneDefaults()
+ .PreferringRuntimeMemberTypes()
.IncludingFields()
.IncludingProperties();
@@ -87,7 +87,7 @@ public static AndConstraint BeJsonSerializable(this ObjectA
catch (Exception exc)
#pragma warning restore CA1031 // Ignore catching general exception
{
- Execute.Assertion
+ assertions.CurrentAssertionChain
.BecauseOf(because, becauseArgs)
.FailWith("Expected {context:object} to be JSON serializable{reason}, but serializing {0} failed with {1}", assertions.Subject, exc);
}
diff --git a/Src/FluentAssertions.Json/StringAssertionsExtensions.cs b/Src/FluentAssertions.Json/StringAssertionsExtensions.cs
index 5fd0036d..d788fc26 100644
--- a/Src/FluentAssertions.Json/StringAssertionsExtensions.cs
+++ b/Src/FluentAssertions.Json/StringAssertionsExtensions.cs
@@ -23,7 +23,7 @@ public static AndWhichConstraint BeValidJson(
catch (Exception ex)
#pragma warning restore CA1031 // Ignore catching general exception
{
- Execute.Assertion.BecauseOf(because, becauseArgs)
+ stringAssertions.CurrentAssertionChain.BecauseOf(because, becauseArgs)
.FailWith("Expected {context:string} to be valid JSON{reason}, but parsing failed with {0}.", ex.Message);
}
diff --git a/Src/FluentAssertions.png b/Src/FluentAssertions.png
index 216d3a3f..94c749a6 100644
Binary files a/Src/FluentAssertions.png and b/Src/FluentAssertions.png differ
diff --git a/Tests/Approval.Tests/Approval.Tests.csproj b/Tests/Approval.Tests/Approval.Tests.csproj
index 28df4ff4..f2fee17d 100644
--- a/Tests/Approval.Tests/Approval.Tests.csproj
+++ b/Tests/Approval.Tests/Approval.Tests.csproj
@@ -5,16 +5,16 @@
-
+
-
-
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
diff --git a/Tests/Approval.Tests/ApprovedApi/FluentAssertions.Json/net47.verified.txt b/Tests/Approval.Tests/ApprovedApi/FluentAssertions.Json/net47.verified.txt
index cd5d0076..74b35143 100644
--- a/Tests/Approval.Tests/ApprovedApi/FluentAssertions.Json/net47.verified.txt
+++ b/Tests/Approval.Tests/ApprovedApi/FluentAssertions.Json/net47.verified.txt
@@ -12,7 +12,7 @@ namespace FluentAssertions.Json
}
public class JTokenAssertions : FluentAssertions.Primitives.ReferenceTypeAssertions
{
- public JTokenAssertions(Newtonsoft.Json.Linq.JToken subject) { }
+ public JTokenAssertions(Newtonsoft.Json.Linq.JToken subject, FluentAssertions.Execution.AssertionChain assertionChain) { }
protected override string Identifier { get; }
public FluentAssertions.AndConstraint BeEquivalentTo(Newtonsoft.Json.Linq.JToken expected, string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint BeEquivalentTo(string expected, string because = "", params object[] becauseArgs) { }
@@ -46,9 +46,9 @@ namespace FluentAssertions.Json
public static FluentAssertions.Json.JTokenAssertions Should(this Newtonsoft.Json.Linq.JToken jToken) { }
public static FluentAssertions.Json.JTokenAssertions Should(this Newtonsoft.Json.Linq.JValue jValue) { }
}
- public sealed class JsonAssertionOptions : FluentAssertions.Equivalency.EquivalencyAssertionOptions, FluentAssertions.Json.IJsonAssertionOptions
+ public sealed class JsonAssertionOptions : FluentAssertions.Equivalency.EquivalencyOptions, FluentAssertions.Json.IJsonAssertionOptions
{
- public JsonAssertionOptions(FluentAssertions.Equivalency.EquivalencyAssertionOptions equivalencyAssertionOptions) { }
+ public JsonAssertionOptions(FluentAssertions.Equivalency.EquivalencyOptions equivalencyAssertionOptions) { }
public FluentAssertions.Json.IJsonAssertionRestriction Using(System.Action> action) { }
}
public sealed class JsonAssertionRestriction : FluentAssertions.Json.IJsonAssertionRestriction
@@ -63,7 +63,7 @@ namespace FluentAssertions.Json
[FluentAssertions.CustomAssertion]
public static FluentAssertions.AndConstraint BeJsonSerializable(this FluentAssertions.Primitives.ObjectAssertions assertions, string because = "", params object[] becauseArgs) { }
[FluentAssertions.CustomAssertion]
- public static FluentAssertions.AndConstraint BeJsonSerializable(this FluentAssertions.Primitives.ObjectAssertions assertions, System.Func, FluentAssertions.Equivalency.EquivalencyAssertionOptions> options, string because = "", params object[] becauseArgs) { }
+ public static FluentAssertions.AndConstraint BeJsonSerializable(this FluentAssertions.Primitives.ObjectAssertions assertions, System.Func, FluentAssertions.Equivalency.EquivalencyOptions> options, string because = "", params object[] becauseArgs) { }
}
public static class StringAssertionsExtensions
{
diff --git a/Tests/Approval.Tests/ApprovedApi/FluentAssertions.Json/netstandard2.0.verified.txt b/Tests/Approval.Tests/ApprovedApi/FluentAssertions.Json/netstandard2.0.verified.txt
index cd5d0076..74b35143 100644
--- a/Tests/Approval.Tests/ApprovedApi/FluentAssertions.Json/netstandard2.0.verified.txt
+++ b/Tests/Approval.Tests/ApprovedApi/FluentAssertions.Json/netstandard2.0.verified.txt
@@ -12,7 +12,7 @@ namespace FluentAssertions.Json
}
public class JTokenAssertions : FluentAssertions.Primitives.ReferenceTypeAssertions
{
- public JTokenAssertions(Newtonsoft.Json.Linq.JToken subject) { }
+ public JTokenAssertions(Newtonsoft.Json.Linq.JToken subject, FluentAssertions.Execution.AssertionChain assertionChain) { }
protected override string Identifier { get; }
public FluentAssertions.AndConstraint BeEquivalentTo(Newtonsoft.Json.Linq.JToken expected, string because = "", params object[] becauseArgs) { }
public FluentAssertions.AndConstraint BeEquivalentTo(string expected, string because = "", params object[] becauseArgs) { }
@@ -46,9 +46,9 @@ namespace FluentAssertions.Json
public static FluentAssertions.Json.JTokenAssertions Should(this Newtonsoft.Json.Linq.JToken jToken) { }
public static FluentAssertions.Json.JTokenAssertions Should(this Newtonsoft.Json.Linq.JValue jValue) { }
}
- public sealed class JsonAssertionOptions : FluentAssertions.Equivalency.EquivalencyAssertionOptions, FluentAssertions.Json.IJsonAssertionOptions
+ public sealed class JsonAssertionOptions : FluentAssertions.Equivalency.EquivalencyOptions, FluentAssertions.Json.IJsonAssertionOptions
{
- public JsonAssertionOptions(FluentAssertions.Equivalency.EquivalencyAssertionOptions equivalencyAssertionOptions) { }
+ public JsonAssertionOptions(FluentAssertions.Equivalency.EquivalencyOptions equivalencyAssertionOptions) { }
public FluentAssertions.Json.IJsonAssertionRestriction Using(System.Action> action) { }
}
public sealed class JsonAssertionRestriction : FluentAssertions.Json.IJsonAssertionRestriction
@@ -63,7 +63,7 @@ namespace FluentAssertions.Json
[FluentAssertions.CustomAssertion]
public static FluentAssertions.AndConstraint BeJsonSerializable(this FluentAssertions.Primitives.ObjectAssertions assertions, string because = "", params object[] becauseArgs) { }
[FluentAssertions.CustomAssertion]
- public static FluentAssertions.AndConstraint BeJsonSerializable(this FluentAssertions.Primitives.ObjectAssertions assertions, System.Func, FluentAssertions.Equivalency.EquivalencyAssertionOptions> options, string because = "", params object[] becauseArgs) { }
+ public static FluentAssertions.AndConstraint BeJsonSerializable(this FluentAssertions.Primitives.ObjectAssertions assertions, System.Func, FluentAssertions.Equivalency.EquivalencyOptions> options, string because = "", params object[] becauseArgs) { }
}
public static class StringAssertionsExtensions
{
diff --git a/Tests/FluentAssertions.Json.Specs/FluentAssertions.Json.Specs.csproj b/Tests/FluentAssertions.Json.Specs/FluentAssertions.Json.Specs.csproj
index 090ed711..b4482f52 100644
--- a/Tests/FluentAssertions.Json.Specs/FluentAssertions.Json.Specs.csproj
+++ b/Tests/FluentAssertions.Json.Specs/FluentAssertions.Json.Specs.csproj
@@ -17,12 +17,12 @@
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/Tests/FluentAssertions.Json.Specs/JTokenAssertionsSpecs.cs b/Tests/FluentAssertions.Json.Specs/JTokenAssertionsSpecs.cs
index 81cb74fc..6193dcd9 100644
--- a/Tests/FluentAssertions.Json.Specs/JTokenAssertionsSpecs.cs
+++ b/Tests/FluentAssertions.Json.Specs/JTokenAssertionsSpecs.cs
@@ -773,7 +773,7 @@ public void When_expecting_a_different_number_of_elements_than_the_actual_number
// Assert
act.Should().Throw()
- .WithMessage("Expected JSON document * to contain 1 item(s) because numbers matter, but found 0.");
+ .WithMessage("Expected JSON document * to contain 1 item(s) because numbers matter, but found 0*");
}
[Fact]
@@ -800,7 +800,7 @@ public void When_expecting_a_different_number_of_array_items_than_the_actual_num
// Assert
act.Should().Throw()
- .WithMessage("Expected JSON document * to contain 3 item(s) because the more the better, but found 2.");
+ .WithMessage("Expected JSON document * to contain 3 item(s) because the more the better, but found 2*");
}
#endregion HaveCount
diff --git a/Tests/FluentAssertions.Json.Specs/JsonAssertionExtensionsSpecs.cs b/Tests/FluentAssertions.Json.Specs/JsonAssertionExtensionsSpecs.cs
index dd9375a3..fbe44f2a 100644
--- a/Tests/FluentAssertions.Json.Specs/JsonAssertionExtensionsSpecs.cs
+++ b/Tests/FluentAssertions.Json.Specs/JsonAssertionExtensionsSpecs.cs
@@ -27,7 +27,7 @@ public void Should_Provide_Unambiguos_JTokenAssertions()
// Act & Assert
foreach (var sut in assertions)
{
- sut.Should().BeOfType("extensions should provide assertions for all JSon primitives, i.e. JObject, JToken and JProperty");
+ ((object)sut).Should().BeOfType("extensions should provide assertions for all JSon primitives, i.e. JObject, JToken and JProperty");
}
}
}
diff --git a/Tests/FluentAssertions.Json.Specs/JsonAssertionOptionsSpecs.cs b/Tests/FluentAssertions.Json.Specs/JsonAssertionOptionsSpecs.cs
index 6b8142b1..b246f509 100644
--- a/Tests/FluentAssertions.Json.Specs/JsonAssertionOptionsSpecs.cs
+++ b/Tests/FluentAssertions.Json.Specs/JsonAssertionOptionsSpecs.cs
@@ -25,14 +25,14 @@ public void Local_equivalency_options_are_applied_on_top_of_global_equivalency_o
private sealed class TempDefaultAssertionOptions : IDisposable
{
- public TempDefaultAssertionOptions(Func config)
+ public TempDefaultAssertionOptions(Func config)
{
- AssertionOptions.AssertEquivalencyUsing(config);
+ AssertionConfiguration.Current.Equivalency.Modify(config);
}
public void Dispose()
{
- AssertionOptions.AssertEquivalencyUsing(_ => new EquivalencyAssertionOptions());
+ AssertionConfiguration.Current.Equivalency.Modify(_ => new());
}
}
}
diff --git a/build.ps1 b/build.ps1
index b3a8824d..4634dc03 100644
--- a/build.ps1
+++ b/build.ps1
@@ -14,17 +14,14 @@ $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
###########################################################################
$BuildProjectFile = "$PSScriptRoot\build\_build.csproj"
-$TempDirectory = "$PSScriptRoot\.nuke\temp"
+$TempDirectory = "$PSScriptRoot\\.nuke\temp"
-$DotNetGlobalFile = "$PSScriptRoot\global.json"
+$DotNetGlobalFile = "$PSScriptRoot\\global.json"
$DotNetInstallUrl = "https://dot.net/v1/dotnet-install.ps1"
-$DotNetChannel = "Current"
+$DotNetChannel = "STS"
-$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1
$env:DOTNET_CLI_TELEMETRY_OPTOUT = 1
-$env:DOTNET_MULTILEVEL_LOOKUP = 0
-$env:DOTNET_ROLL_FORWARD = "Major"
-$env:NUKE_TELEMETRY_OPTOUT = 1
+$env:DOTNET_NOLOGO = 1
###########################################################################
# EXECUTION
@@ -35,18 +32,9 @@ function ExecSafe([scriptblock] $cmd) {
if ($LASTEXITCODE) { exit $LASTEXITCODE }
}
-# Print environment variables
-# WARNING: Make sure that secrets are actually scrambled in build log
-# Get-Item -Path Env:* | Sort-Object -Property Name | ForEach-Object {"{0}={1}" -f $_.Name,$_.Value}
-
-# Check if any dotnet is installed
-if ($null -ne (Get-Command "dotnet" -ErrorAction SilentlyContinue)) {
- ExecSafe { & dotnet --info }
-}
-
# If dotnet CLI is installed globally and it matches requested version, use for execution
if ($null -ne (Get-Command "dotnet" -ErrorAction SilentlyContinue) -and `
- $(dotnet --version) -and $LASTEXITCODE -eq 0) {
+ $(dotnet --version) -and $LASTEXITCODE -eq 0) {
$env:DOTNET_EXE = (Get-Command "dotnet").Path
}
else {
@@ -72,9 +60,15 @@ else {
ExecSafe { & powershell $DotNetInstallFile -InstallDir $DotNetDirectory -Version $DotNetVersion -NoPath }
}
$env:DOTNET_EXE = "$DotNetDirectory\dotnet.exe"
+ $env:PATH = "$DotNetDirectory;$env:PATH"
}
-Write-Output "Microsoft (R) .NET Core SDK version $(& $env:DOTNET_EXE --version)"
+Write-Output "Microsoft (R) .NET SDK version $(& $env:DOTNET_EXE --version)"
+
+if (Test-Path env:NUKE_ENTERPRISE_TOKEN) {
+ & $env:DOTNET_EXE nuget remove source "nuke-enterprise" > $null
+ & $env:DOTNET_EXE nuget add source "https://f.feedz.io/nuke/enterprise/nuget" --name "nuke-enterprise" --username "PAT" --password $env:NUKE_ENTERPRISE_TOKEN > $null
+}
-ExecSafe { & $env:DOTNET_EXE build $BuildProjectFile /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary }
+ExecSafe { & $env:DOTNET_EXE build $BuildProjectFile /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet }
ExecSafe { & $env:DOTNET_EXE run --project $BuildProjectFile --no-build -- $BuildArguments }
diff --git a/build.sh b/build.sh
index f5bf05e1..2063070b 100755
--- a/build.sh
+++ b/build.sh
@@ -10,17 +10,14 @@ SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
###########################################################################
BUILD_PROJECT_FILE="$SCRIPT_DIR/Build/_build.csproj"
-TEMP_DIRECTORY="$SCRIPT_DIR/.nuke/temp"
+TEMP_DIRECTORY="$SCRIPT_DIR//.nuke/temp"
-DOTNET_GLOBAL_FILE="$SCRIPT_DIR/global.json"
+DOTNET_GLOBAL_FILE="$SCRIPT_DIR//global.json"
DOTNET_INSTALL_URL="https://dot.net/v1/dotnet-install.sh"
-DOTNET_CHANNEL="Current"
+DOTNET_CHANNEL="STS"
export DOTNET_CLI_TELEMETRY_OPTOUT=1
-export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
-export DOTNET_MULTILEVEL_LOOKUP=0
-export DOTNET_ROLL_FORWARD="Major"
-export NUKE_TELEMETRY_OPTOUT=1
+export DOTNET_NOLOGO=1
###########################################################################
# EXECUTION
@@ -30,15 +27,6 @@ function FirstJsonValue {
perl -nle 'print $1 if m{"'"$1"'": "([^"]+)",?}' <<< "${@:2}"
}
-# Print environment variables
-# WARNING: Make sure that secrets are actually scrambled in build log
-# env | sort
-
-# Check if any dotnet is installed
-if [[ -x "$(command -v dotnet)" ]]; then
- dotnet --info
-fi
-
# If dotnet CLI is installed globally and it matches requested version, use for execution
if [ -x "$(command -v dotnet)" ] && dotnet --version &>/dev/null; then
export DOTNET_EXE="$(command -v dotnet)"
@@ -65,9 +53,15 @@ else
"$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --version "$DOTNET_VERSION" --no-path
fi
export DOTNET_EXE="$DOTNET_DIRECTORY/dotnet"
+ export PATH="$DOTNET_DIRECTORY:$PATH"
fi
-echo "Microsoft (R) .NET Core SDK version $("$DOTNET_EXE" --version)"
+echo "Microsoft (R) .NET SDK version $("$DOTNET_EXE" --version)"
+
+if [[ ! -z ${NUKE_ENTERPRISE_TOKEN+x} && "$NUKE_ENTERPRISE_TOKEN" != "" ]]; then
+ "$DOTNET_EXE" nuget remove source "nuke-enterprise" &>/dev/null || true
+ "$DOTNET_EXE" nuget add source "https://f.feedz.io/nuke/enterprise/nuget" --name "nuke-enterprise" --username "PAT" --password "$NUKE_ENTERPRISE_TOKEN" --store-password-in-clear-text &>/dev/null || true
+fi
-"$DOTNET_EXE" build "$BUILD_PROJECT_FILE" /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary
+"$DOTNET_EXE" build "$BUILD_PROJECT_FILE" /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet
"$DOTNET_EXE" run --project "$BUILD_PROJECT_FILE" --no-build -- "$@"
diff --git a/global.json b/global.json
index 368a14e3..d07970ac 100644
--- a/global.json
+++ b/global.json
@@ -1,6 +1,6 @@
{
- "sdk": {
- "version": "8.0.100",
- "rollForward": "latestMajor"
- }
+ "sdk": {
+ "version": "8.0.100",
+ "rollForward": "latestMajor"
+ }
}