diff --git a/Build/_build.csproj.DotSettings b/Build/_build.csproj.DotSettings
index 9aac7d8e8d..7348ae5acb 100644
--- a/Build/_build.csproj.DotSettings
+++ b/Build/_build.csproj.DotSettings
@@ -13,6 +13,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" Prefix="" Suffix="" Style="AaBb" /></Policy>
+ <Policy><Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static fields (private)"><ElementKinds><Kind Name="FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></Policy>
True
True
True
@@ -21,4 +23,5 @@
True
True
True
- True
+ True
+ True
diff --git a/FluentAssertions.sln.DotSettings b/FluentAssertions.sln.DotSettings
index 318b42ebc7..785299fbe3 100644
--- a/FluentAssertions.sln.DotSettings
+++ b/FluentAssertions.sln.DotSettings
@@ -104,6 +104,8 @@
UseExplicitType
<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" Prefix="" Suffix="" Style="aaBb" /></Policy>
+ <Policy><Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static fields (private)"><ElementKinds><Kind Name="FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" 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" />
@@ -154,6 +156,7 @@
True
True
True
+ True
D:\Workspaces\FluentAssertions\Default.testsettings
4
False
diff --git a/Src/FluentAssertions/AndWhich.cs b/Src/FluentAssertions/AndWhich.cs
index 0ef993bc02..0e0e2d30ce 100644
--- a/Src/FluentAssertions/AndWhich.cs
+++ b/Src/FluentAssertions/AndWhich.cs
@@ -9,16 +9,16 @@ namespace FluentAssertions;
public class AndWhich : AndConstraint
{
- private readonly Assertion assertion;
+ private readonly AssertionChain assertionChain;
private readonly string pathPostfix;
private readonly Lazy getSubject;
- public AndWhich(TParent parent, TSubject subject, Assertion assertion, string pathPostfix)
+ public AndWhich(TParent parent, TSubject subject, AssertionChain assertionChain, string pathPostfix)
: base(parent)
{
getSubject = new Lazy(() => subject);
- this.assertion = assertion;
+ this.assertionChain = assertionChain;
this.pathPostfix = pathPostfix;
}
@@ -43,9 +43,9 @@ public TSubject Which
{
get
{
- assertion.AddCallerPostfix(pathPostfix);
+ assertionChain.AddCallerPostfix(pathPostfix);
- Assertion.ReuseOnce(assertion);
+ AssertionChain.ReuseOnce(assertionChain);
return getSubject.Value;
}
diff --git a/Src/FluentAssertions/AssertionExtensions.cs b/Src/FluentAssertions/AssertionExtensions.cs
index 1e17c0ec97..6fddf39bbe 100644
--- a/Src/FluentAssertions/AssertionExtensions.cs
+++ b/Src/FluentAssertions/AssertionExtensions.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
-using System.Data;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
@@ -167,8 +166,7 @@ public static ExecutionTime ExecutionTime(this Func action)
[Pure]
public static ExecutionTimeAssertions Should(this ExecutionTime executionTime)
{
- return new ExecutionTimeAssertions(executionTime, Assertion.GetOrCreate(() => AssertionScope.Current,
- () => AssertionScope.Current.GetIdentifier()));
+ return new ExecutionTimeAssertions(executionTime, AssertionChain.GetOrCreate());
}
///
@@ -178,8 +176,7 @@ public static ExecutionTimeAssertions Should(this ExecutionTime executionTime)
[Pure]
public static AssemblyAssertions Should(this Assembly assembly)
{
- return new AssemblyAssertions(assembly, Assertion.GetOrCreate(() => AssertionScope.Current,
- () => AssertionScope.Current.GetIdentifier()));
+ return new AssemblyAssertions(assembly, AssertionChain.GetOrCreate());
}
///
@@ -189,8 +186,7 @@ public static AssemblyAssertions Should(this Assembly assembly)
[Pure]
public static XDocumentAssertions Should(this XDocument actualValue)
{
- return new XDocumentAssertions(actualValue, Assertion.GetOrCreate(() => AssertionScope.Current,
- () => AssertionScope.Current.GetIdentifier()));
+ return new XDocumentAssertions(actualValue, AssertionChain.GetOrCreate());
}
///
@@ -200,8 +196,7 @@ public static XDocumentAssertions Should(this XDocument actualValue)
[Pure]
public static XElementAssertions Should(this XElement actualValue)
{
- return new XElementAssertions(actualValue, Assertion.GetOrCreate(() => AssertionScope.Current,
- () => AssertionScope.Current.GetIdentifier()));
+ return new XElementAssertions(actualValue, AssertionChain.GetOrCreate());
}
///
@@ -211,8 +206,7 @@ public static XElementAssertions Should(this XElement actualValue)
[Pure]
public static XAttributeAssertions Should(this XAttribute actualValue)
{
- return new XAttributeAssertions(actualValue, Assertion.GetOrCreate(() => AssertionScope.Current,
- () => AssertionScope.Current.GetIdentifier()));
+ return new XAttributeAssertions(actualValue, AssertionChain.GetOrCreate());
}
///
@@ -222,8 +216,7 @@ public static XAttributeAssertions Should(this XAttribute actualValue)
[Pure]
public static StreamAssertions Should(this Stream actualValue)
{
- return new StreamAssertions(actualValue, Assertion.GetOrCreate(() => AssertionScope.Current,
- () => AssertionScope.Current.GetIdentifier()));
+ return new StreamAssertions(actualValue, AssertionChain.GetOrCreate());
}
///
@@ -233,8 +226,7 @@ public static StreamAssertions Should(this Stream actualValue)
[Pure]
public static BufferedStreamAssertions Should(this BufferedStream actualValue)
{
- return new BufferedStreamAssertions(actualValue, Assertion.GetOrCreate(() => AssertionScope.Current,
- () => AssertionScope.Current.GetIdentifier()));
+ return new BufferedStreamAssertions(actualValue, AssertionChain.GetOrCreate());
}
///
@@ -291,14 +283,12 @@ private static void ForceEnumeration(T subject, Func enumerab
[Pure]
public static ObjectAssertions Should(this object actualValue)
{
- return new ObjectAssertions(actualValue, Assertion.GetOrCreate(() => AssertionScope.Current,
- () => AssertionScope.Current.GetIdentifier()));
+ return new ObjectAssertions(actualValue, AssertionChain.GetOrCreate());
}
public static ObjectAssertions Should(this WhichResult