Skip to content

Commit 231191e

Browse files
committed
refs
1 parent b630988 commit 231191e

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

src/Directory.Packages.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
55
</PropertyGroup>
66
<ItemGroup>
7-
<PackageVersion Include="Argon" Version="0.24.1" />
8-
<PackageVersion Include="Argon.FSharp" Version="0.24.1" />
7+
<PackageVersion Include="Argon" Version="0.24.2" />
8+
<PackageVersion Include="Argon.FSharp" Version="0.24.2" />
99
<PackageVersion Include="BenchmarkDotNet" Version="0.14.0" />
1010
<PackageVersion Include="DiffEngine" Version="15.5.3" />
1111
<PackageVersion Include="Expecto" Version="10.2.1" />

src/Verify/Serialization/CustomContractResolver.cs

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,39 @@ protected override JsonDictionaryContract CreateDictionaryContract(Type objectTy
1515
if (key is string stringKey &&
1616
settings.TryGetScrubOrIgnoreByName(stringKey, out var scrubOrIgnore))
1717
{
18-
return ToInterceptResult(scrubOrIgnore.Value);
18+
return ToInterceptKeyValueResult(scrubOrIgnore.Value);
1919
}
2020

2121
if (value is not null &&
2222
settings.TryGetScrubOrIgnoreByInstance(value, out scrubOrIgnore))
2323
{
24-
return ToInterceptResult(scrubOrIgnore.Value);
24+
return ToInterceptKeyValueResult(scrubOrIgnore.Value);
2525
}
2626

27-
return InterceptResult.Default;
27+
return KeyValueInterceptResult.Default;
2828
};
2929

3030
return contract;
3131
}
3232

33-
static InterceptResult ToInterceptResult(ScrubOrIgnore scrubOrIgnore)
33+
static KeyValueInterceptResult ToInterceptKeyValueResult(ScrubOrIgnore scrubOrIgnore)
3434
{
3535
if (scrubOrIgnore == ScrubOrIgnore.Ignore)
3636
{
37-
return InterceptResult.Ignore;
37+
return KeyValueInterceptResult.Ignore;
3838
}
3939

40-
return InterceptResult.Replace("{Scrubbed}");
40+
return KeyValueInterceptResult.ReplaceValue("{Scrubbed}");
41+
}
42+
43+
static ItemInterceptResult ToInterceptItemResult(ScrubOrIgnore scrubOrIgnore)
44+
{
45+
if (scrubOrIgnore == ScrubOrIgnore.Ignore)
46+
{
47+
return ItemInterceptResult.Ignore;
48+
}
49+
50+
return ItemInterceptResult.Replace("{Scrubbed}");
4151
}
4252

4353
string ResolveDictionaryKey(JsonDictionaryContract contract, string name, object original)
@@ -213,10 +223,10 @@ protected override JsonArrayContract CreateArrayContract(Type objectType)
213223
if (item is not null &&
214224
settings.TryGetScrubOrIgnoreByInstance(item, out var scrubOrIgnore))
215225
{
216-
return ToInterceptResult(scrubOrIgnore.Value);
226+
return ToInterceptItemResult(scrubOrIgnore.Value);
217227
}
218228

219-
return InterceptResult.Default;
229+
return ItemInterceptResult.Default;
220230
};
221231

222232
if (contract.CollectionItemType != null &&

0 commit comments

Comments
 (0)