Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/guids.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var target = new GuidTarget

await Verify(target);
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L2273-L2286' title='Snippet source file'>snippet source</a> | <a href='#snippet-guid' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L2320-L2333' title='Snippet source file'>snippet source</a> | <a href='#snippet-guid' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Results in the following:
Expand Down
8 changes: 4 additions & 4 deletions docs/members-throw.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public Task CustomExceptionPropFluent()
.IgnoreMembersThatThrow<CustomException>();
}
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L3988-L4007' title='Snippet source file'>snippet source</a> | <a href='#snippet-IgnoreMembersThatThrow' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L4035-L4054' title='Snippet source file'>snippet source</a> | <a href='#snippet-IgnoreMembersThatThrow' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Or globally:
Expand All @@ -45,7 +45,7 @@ Or globally:
```cs
VerifierSettings.IgnoreMembersThatThrow<CustomException>();
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L3982-L3986' title='Snippet source file'>snippet source</a> | <a href='#snippet-IgnoreMembersThatThrowGlobal' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L4029-L4033' title='Snippet source file'>snippet source</a> | <a href='#snippet-IgnoreMembersThatThrowGlobal' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Result:
Expand Down Expand Up @@ -82,7 +82,7 @@ public Task ExceptionMessagePropFluent()
.IgnoreMembersThatThrow<Exception>(_ => _.Message == "Ignore");
}
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L2616-L2637' title='Snippet source file'>snippet source</a> | <a href='#snippet-IgnoreMembersThatThrowExpression' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L2663-L2684' title='Snippet source file'>snippet source</a> | <a href='#snippet-IgnoreMembersThatThrowExpression' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Or globally:
Expand All @@ -92,7 +92,7 @@ Or globally:
```cs
VerifierSettings.IgnoreMembersThatThrow<Exception>(_ => _.Message == "Ignore");
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L2609-L2613' title='Snippet source file'>snippet source</a> | <a href='#snippet-IgnoreMembersThatThrowExpressionGlobal' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L2656-L2660' title='Snippet source file'>snippet source</a> | <a href='#snippet-IgnoreMembersThatThrowExpressionGlobal' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Result:
Expand Down
6 changes: 3 additions & 3 deletions docs/obsolete-members.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public Task WithObsoleteProp()
return Verify(target);
}
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L4135-L4156' title='Snippet source file'>snippet source</a> | <a href='#snippet-WithObsoleteProp' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L4182-L4203' title='Snippet source file'>snippet source</a> | <a href='#snippet-WithObsoleteProp' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Result:
Expand Down Expand Up @@ -79,7 +79,7 @@ public Task WithObsoletePropIncludedFluent()
.IncludeObsoletes();
}
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L4106-L4133' title='Snippet source file'>snippet source</a> | <a href='#snippet-WithObsoletePropIncluded' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L4153-L4180' title='Snippet source file'>snippet source</a> | <a href='#snippet-WithObsoletePropIncluded' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Or globally:
Expand All @@ -89,7 +89,7 @@ Or globally:
```cs
VerifierSettings.IncludeObsoletes();
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L4100-L4104' title='Snippet source file'>snippet source</a> | <a href='#snippet-WithObsoletePropIncludedGlobally' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L4147-L4151' title='Snippet source file'>snippet source</a> | <a href='#snippet-WithObsoletePropIncludedGlobally' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Result:
Expand Down
46 changes: 23 additions & 23 deletions docs/serializer-settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ var settings = new JsonSerializerSettings
DefaultValueHandling = DefaultValueHandling.Ignore
};
```
<sup><a href='/src/Verify/Serialization/SerializationSettings.cs#L96-L105' title='Snippet source file'>snippet source</a> | <a href='#snippet-defaultSerialization' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify/Serialization/SerializationSettings.cs#L97-L106' title='Snippet source file'>snippet source</a> | <a href='#snippet-defaultSerialization' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand Down Expand Up @@ -495,7 +495,7 @@ public Task ScopedSerializerFluent()
.AddExtraSettings(_ => _.TypeNameHandling = TypeNameHandling.All);
}
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L4170-L4197' title='Snippet source file'>snippet source</a> | <a href='#snippet-ScopedSerializer' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L4217-L4244' title='Snippet source file'>snippet source</a> | <a href='#snippet-ScopedSerializer' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Result:
Expand Down Expand Up @@ -623,7 +623,7 @@ public Task IgnoreTypeFluent()
.IgnoreMembersWithType<ToIgnoreStruct>();
}
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L3034-L3139' title='Snippet source file'>snippet source</a> | <a href='#snippet-AddIgnoreType' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L3081-L3186' title='Snippet source file'>snippet source</a> | <a href='#snippet-AddIgnoreType' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Or globally:
Expand All @@ -633,7 +633,7 @@ Or globally:
```cs
VerifierSettings.IgnoreMembersWithType<ToIgnore>();
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L3021-L3025' title='Snippet source file'>snippet source</a> | <a href='#snippet-AddIgnoreTypeGlobal' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L3068-L3072' title='Snippet source file'>snippet source</a> | <a href='#snippet-AddIgnoreTypeGlobal' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Result:
Expand Down Expand Up @@ -770,7 +770,7 @@ public Task ScrubTypeFluent()
.ScrubMembersWithType<ToIgnoreStruct>();
}
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L3142-L3247' title='Snippet source file'>snippet source</a> | <a href='#snippet-AddScrubType' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L3189-L3294' title='Snippet source file'>snippet source</a> | <a href='#snippet-AddScrubType' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Or globally:
Expand All @@ -780,7 +780,7 @@ Or globally:
```cs
VerifierSettings.ScrubMembersWithType<ToIgnore>();
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L3027-L3031' title='Snippet source file'>snippet source</a> | <a href='#snippet-AddScrubTypeGlobal' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L3074-L3078' title='Snippet source file'>snippet source</a> | <a href='#snippet-AddScrubTypeGlobal' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Result:
Expand Down Expand Up @@ -859,7 +859,7 @@ public Task AddIgnoreInstanceFluent()
.IgnoreInstance<Instance>(_ => _.Property == "Ignore");
}
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L2907-L2946' title='Snippet source file'>snippet source</a> | <a href='#snippet-AddIgnoreInstance' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L2954-L2993' title='Snippet source file'>snippet source</a> | <a href='#snippet-AddIgnoreInstance' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Or globally:
Expand All @@ -869,7 +869,7 @@ Or globally:
```cs
VerifierSettings.IgnoreInstance<Instance>(_ => _.Property == "Ignore");
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L2894-L2898' title='Snippet source file'>snippet source</a> | <a href='#snippet-AddIgnoreInstanceGlobal' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L2941-L2945' title='Snippet source file'>snippet source</a> | <a href='#snippet-AddIgnoreInstanceGlobal' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Result:
Expand Down Expand Up @@ -931,7 +931,7 @@ public Task AddScrubInstanceFluent()
.ScrubInstance<Instance>(_ => _.Property == "Ignore");
}
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L2948-L2987' title='Snippet source file'>snippet source</a> | <a href='#snippet-AddScrubInstance' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L2995-L3034' title='Snippet source file'>snippet source</a> | <a href='#snippet-AddScrubInstance' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Or globally:
Expand All @@ -941,7 +941,7 @@ Or globally:
```cs
VerifierSettings.ScrubInstance<Instance>(_ => _.Property == "Ignore");
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L2900-L2904' title='Snippet source file'>snippet source</a> | <a href='#snippet-AddScrubInstanceGlobal' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L2947-L2951' title='Snippet source file'>snippet source</a> | <a href='#snippet-AddScrubInstanceGlobal' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Result:
Expand Down Expand Up @@ -1004,7 +1004,7 @@ public Task IgnoreMemberByExpressionFluent()
_ => _.PropertyThatThrows);
}
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L3463-L3502' title='Snippet source file'>snippet source</a> | <a href='#snippet-IgnoreMemberByExpression' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L3510-L3549' title='Snippet source file'>snippet source</a> | <a href='#snippet-IgnoreMemberByExpression' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Or globally
Expand All @@ -1019,7 +1019,7 @@ VerifierSettings.IgnoreMembers<IgnoreExplicitTarget>(
_ => _.GetOnlyProperty,
_ => _.PropertyThatThrows);
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L3440-L3449' title='Snippet source file'>snippet source</a> | <a href='#snippet-IgnoreMemberByExpressionGlobal' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L3487-L3496' title='Snippet source file'>snippet source</a> | <a href='#snippet-IgnoreMemberByExpressionGlobal' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Result:
Expand Down Expand Up @@ -1079,7 +1079,7 @@ public Task ScrubMemberByExpressionFluent()
_ => _.PropertyThatThrows);
}
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L3504-L3543' title='Snippet source file'>snippet source</a> | <a href='#snippet-ScrubMemberByExpression' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L3551-L3590' title='Snippet source file'>snippet source</a> | <a href='#snippet-ScrubMemberByExpression' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Or globally
Expand All @@ -1094,7 +1094,7 @@ VerifierSettings.ScrubMembers<IgnoreExplicitTarget>(
_ => _.GetOnlyProperty,
_ => _.PropertyThatThrows);
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L3451-L3460' title='Snippet source file'>snippet source</a> | <a href='#snippet-ScrubMemberByExpressionGlobal' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L3498-L3507' title='Snippet source file'>snippet source</a> | <a href='#snippet-ScrubMemberByExpressionGlobal' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Result:
Expand Down Expand Up @@ -1173,7 +1173,7 @@ public Task IgnoreMemberByNameFluent()
.IgnoreMember<IgnoreExplicitTarget>(_ => _.PropertyThatThrows);
}
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L3635-L3688' title='Snippet source file'>snippet source</a> | <a href='#snippet-IgnoreMemberByName' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L3682-L3735' title='Snippet source file'>snippet source</a> | <a href='#snippet-IgnoreMemberByName' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Or globally:
Expand All @@ -1193,7 +1193,7 @@ VerifierSettings.IgnoreMember<IgnoreExplicitTarget>("Field");
// For a specific type with expression
VerifierSettings.IgnoreMember<IgnoreExplicitTarget>(_ => _.PropertyThatThrows);
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L3584-L3598' title='Snippet source file'>snippet source</a> | <a href='#snippet-IgnoreMemberByNameGlobal' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L3631-L3645' title='Snippet source file'>snippet source</a> | <a href='#snippet-IgnoreMemberByNameGlobal' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Result:
Expand Down Expand Up @@ -1268,7 +1268,7 @@ public Task ScrubMemberByNameFluent()
.ScrubMember<IgnoreExplicitTarget>(_ => _.PropertyThatThrows);
}
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L3690-L3743' title='Snippet source file'>snippet source</a> | <a href='#snippet-ScrubMemberByName' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L3737-L3790' title='Snippet source file'>snippet source</a> | <a href='#snippet-ScrubMemberByName' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Or globally:
Expand All @@ -1288,7 +1288,7 @@ VerifierSettings.ScrubMember<IgnoreExplicitTarget>("Field");
// For a specific type with expression
VerifierSettings.ScrubMember<IgnoreExplicitTarget>(_ => _.PropertyThatThrows);
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L3600-L3614' title='Snippet source file'>snippet source</a> | <a href='#snippet-ScrubMemberByNameGlobal' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L3647-L3661' title='Snippet source file'>snippet source</a> | <a href='#snippet-ScrubMemberByNameGlobal' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Result:
Expand Down Expand Up @@ -1381,7 +1381,7 @@ public Task IgnoreDictionaryByPredicate()
return Verify(target, settings);
}
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L3814-L3881' title='Snippet source file'>snippet source</a> | <a href='#snippet-IgnoreMemberByPredicate' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L3861-L3928' title='Snippet source file'>snippet source</a> | <a href='#snippet-IgnoreMemberByPredicate' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Or globally:
Expand All @@ -1393,7 +1393,7 @@ VerifierSettings.IgnoreMembers(
_=>_.DeclaringType == typeof(TargetClass) &&
_.Name == "Proprty");
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L3624-L3630' title='Snippet source file'>snippet source</a> | <a href='#snippet-IgnoreMemberByPredicateGlobal' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L3671-L3677' title='Snippet source file'>snippet source</a> | <a href='#snippet-IgnoreMemberByPredicateGlobal' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Result:
Expand Down Expand Up @@ -1482,7 +1482,7 @@ public Task ScrubDictionaryByPredicate()
return Verify(target, settings);
}
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L3745-L3812' title='Snippet source file'>snippet source</a> | <a href='#snippet-ScrubMemberByPredicate' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L3792-L3859' title='Snippet source file'>snippet source</a> | <a href='#snippet-ScrubMemberByPredicate' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Or globally:
Expand All @@ -1494,7 +1494,7 @@ VerifierSettings.ScrubMembers(
_=>_.DeclaringType == typeof(TargetClass) &&
_.Name == "Proprty");
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L3616-L3622' title='Snippet source file'>snippet source</a> | <a href='#snippet-ScrubMemberByPredicateGlobal' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L3663-L3669' title='Snippet source file'>snippet source</a> | <a href='#snippet-ScrubMemberByPredicateGlobal' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Result:
Expand Down Expand Up @@ -1548,7 +1548,7 @@ public Task MemberConverterByExpression()
return Verify(input);
}
```
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L3545-L3573' title='Snippet source file'>snippet source</a> | <a href='#snippet-MemberConverter' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/Serialization/SerializationTests.cs#L3592-L3620' title='Snippet source file'>snippet source</a> | <a href='#snippet-MemberConverter' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
Value: {Scrubbed},
Other: keep
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
Value: {Scrubbed},
Other: keep
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
Value: {Scrubbed},
Other: keep
}
33 changes: 33 additions & 0 deletions src/StaticSettingsTests/ScrubMemberGlobalTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
public class ScrubMemberGlobalTests :
BaseTest
{
// The static ScrubMember(s) overloads previously delegated to Ignore*, so a
// member was silently removed instead of rendered as "Scrubbed".

[Fact]
public Task ScrubMemberGeneric()
{
VerifierSettings.ScrubMember<Target>("Value");
return Verify(new Target());
}

[Fact]
public Task ScrubMembersGeneric()
{
VerifierSettings.ScrubMembers<Target>("Value");
return Verify(new Target());
}

[Fact]
public Task ScrubMembersType()
{
VerifierSettings.ScrubMembers(typeof(Target), "Value");
return Verify(new Target());
}

public class Target
{
public string Value { get; set; } = "secret";
public string Other { get; set; } = "keep";
}
}
15 changes: 15 additions & 0 deletions src/Verify.Tests/Serialization/SerializationSettingsCopyTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
public class SerializationSettingsCopyTests
{
[Fact]
public void PreservesOrderDictionaries()
{
var settings = new SerializationSettings
{
OrderDictionaries = false
};

var copy = new SerializationSettings(settings);

Assert.False(copy.OrderDictionaries);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[
single,
multi
line
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
Id: Id_1
}
Loading
Loading