Skip to content

Commit c477e13

Browse files
authored
Replaced static calls on SnapshotExtensions class (#7771)
1 parent 05bb550 commit c477e13

24 files changed

+175
-217
lines changed

src/HotChocolate/Core/test/Execution.Tests/Integration/TypeConverter/TypeConverterTests.cs

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Diagnostics.CodeAnalysis;
2+
using CookieCrumble;
23
using HotChocolate.Tests;
34
using HotChocolate.Types;
45
using HotChocolate.Utilities;
@@ -164,8 +165,7 @@ public async Task UseSet_As_InputType()
164165
.AddQueryType<QuerySet>()
165166
.ExecuteRequestAsync("{ set(set: [\"abc\", \"abc\"]) }");
166167

167-
CookieCrumble.SnapshotExtensions.MatchInlineSnapshot(
168-
result,
168+
result.MatchInlineSnapshot(
169169
"""
170170
{
171171
"data": {
@@ -186,8 +186,7 @@ public async Task UseHashSet_As_InputType()
186186
.AddQueryType<QuerySet>()
187187
.ExecuteRequestAsync("{ set2(set: [\"abc\", \"abc\"]) }");
188188

189-
CookieCrumble.SnapshotExtensions.MatchInlineSnapshot(
190-
result,
189+
result.MatchInlineSnapshot(
191190
"""
192191
{
193192
"data": {

src/HotChocolate/Core/test/Types.Mutations.Tests/AnnotationBasedMutations.cs

+28-28
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ ... on Error {
8282
}
8383
""");
8484

85-
SnapshotExtensions.MatchSnapshot(result);
85+
result.MatchSnapshot();
8686
}
8787

8888
[Fact]
@@ -134,7 +134,7 @@ public async Task SimpleMutationReturnList_Inferred_Execute()
134134
}
135135
""");
136136

137-
SnapshotExtensions.MatchSnapshot(result);
137+
result.MatchSnapshot();
138138
}
139139

140140
[Fact]
@@ -189,7 +189,7 @@ public async Task SimpleMutationExtension_Inferred_Execute()
189189
}
190190
""");
191191

192-
SnapshotExtensions.MatchSnapshot(result);
192+
result.MatchSnapshot();
193193
}
194194

195195
[Fact]
@@ -212,7 +212,7 @@ public async Task SimpleJsonMutationExtension_Inferred_Execute()
212212
}
213213
""");
214214

215-
SnapshotExtensions.MatchSnapshot(result);
215+
result.MatchSnapshot();
216216
}
217217

218218
[Fact]
@@ -248,7 +248,7 @@ public async Task Ensure_That_Directive_Middleware_Play_Nice()
248248
}
249249
""");
250250

251-
SnapshotExtensions.MatchSnapshot(result);
251+
result.MatchSnapshot();
252252
}
253253

254254
[Fact]
@@ -283,7 +283,7 @@ public async Task SimpleMutation_Inferred_Execute()
283283
}
284284
""");
285285

286-
SnapshotExtensions.MatchSnapshot(result);
286+
result.MatchSnapshot();
287287
}
288288

289289
[Fact]
@@ -339,7 +339,7 @@ ... on CustomError {
339339
}
340340
""");
341341

342-
SnapshotExtensions.MatchSnapshot(result);
342+
result.MatchSnapshot();
343343
}
344344

345345
[Fact]
@@ -512,7 +512,7 @@ public async Task Allow_Payload_Result_Field_To_Be_Null()
512512
}
513513
""");
514514

515-
SnapshotExtensions.MatchSnapshot(result);
515+
result.MatchSnapshot();
516516
}
517517

518518
[Fact]
@@ -543,7 +543,7 @@ public async Task Allow_Id_Middleware()
543543
.SetVariableValues(new Dictionary<string, object?> { { "id", id } })
544544
.Build());
545545

546-
SnapshotExtensions.MatchSnapshot(result);
546+
result.MatchSnapshot();
547547
}
548548

549549
[Fact]
@@ -567,7 +567,7 @@ public async Task Allow_Id_Middleware2()
567567
}
568568
""");
569569

570-
SnapshotExtensions.MatchSnapshot(result);
570+
result.MatchSnapshot();
571571
}
572572

573573
[Fact]
@@ -592,7 +592,7 @@ public async Task Allow_InputObject_Middleware()
592592
}
593593
""");
594594

595-
SnapshotExtensions.MatchSnapshot(result);
595+
result.MatchSnapshot();
596596
}
597597

598598
[Fact]
@@ -615,7 +615,7 @@ public async Task Union_Result_1()
615615
}
616616
""");
617617

618-
SnapshotExtensions.MatchSnapshot(result);
618+
result.MatchSnapshot();
619619
}
620620

621621
[Fact]
@@ -653,7 +653,7 @@ public async Task Union_Result_2()
653653
}
654654
""");
655655

656-
SnapshotExtensions.MatchSnapshot(result);
656+
result.MatchSnapshot();
657657
}
658658

659659
[Fact]
@@ -678,7 +678,7 @@ public async Task Union_Result_2_Task()
678678
}
679679
""");
680680

681-
SnapshotExtensions.MatchSnapshot(result);
681+
result.MatchSnapshot();
682682
}
683683

684684
[Fact]
@@ -702,7 +702,7 @@ public async Task Union_Result_2_Success()
702702
}
703703
""");
704704

705-
SnapshotExtensions.MatchSnapshot(result);
705+
result.MatchSnapshot();
706706
}
707707

708708
[Fact]
@@ -770,7 +770,7 @@ public async Task Union_Result_3()
770770
}
771771
""");
772772

773-
SnapshotExtensions.MatchSnapshot(result);
773+
result.MatchSnapshot();
774774
}
775775

776776
[Fact]
@@ -794,7 +794,7 @@ public async Task Union_Result_3_Success()
794794
}
795795
""");
796796

797-
SnapshotExtensions.MatchSnapshot(result);
797+
result.MatchSnapshot();
798798
}
799799

800800
[Fact]
@@ -832,7 +832,7 @@ public async Task Union_Result_4()
832832
}
833833
""");
834834

835-
SnapshotExtensions.MatchSnapshot(result);
835+
result.MatchSnapshot();
836836
}
837837

838838
[Fact]
@@ -856,7 +856,7 @@ public async Task Union_Result_4_Success()
856856
}
857857
""");
858858

859-
SnapshotExtensions.MatchSnapshot(result);
859+
result.MatchSnapshot();
860860
}
861861

862862
[Fact]
@@ -894,7 +894,7 @@ public async Task Union_Result_5()
894894
}
895895
""");
896896

897-
SnapshotExtensions.MatchSnapshot(result);
897+
result.MatchSnapshot();
898898
}
899899

900900
[Fact]
@@ -917,7 +917,7 @@ public async Task Union_Result_5_Success()
917917
}
918918
}
919919
""");
920-
SnapshotExtensions.MatchSnapshot(result);
920+
result.MatchSnapshot();
921921
}
922922

923923
[Fact]
@@ -955,7 +955,7 @@ public async Task Union_Result_6()
955955
}
956956
""");
957957

958-
SnapshotExtensions.MatchSnapshot(result);
958+
result.MatchSnapshot();
959959
}
960960

961961
[Fact]
@@ -979,7 +979,7 @@ public async Task Union_Result_6_Success()
979979
}
980980
""");
981981

982-
SnapshotExtensions.MatchSnapshot(result);
982+
result.MatchSnapshot();
983983
}
984984

985985
[Fact]
@@ -1017,7 +1017,7 @@ public async Task Union_Result_7()
10171017
}
10181018
""");
10191019

1020-
SnapshotExtensions.MatchSnapshot(result);
1020+
result.MatchSnapshot();
10211021
}
10221022

10231023
[Fact]
@@ -1041,7 +1041,7 @@ public async Task Union_Result_7_Success()
10411041
}
10421042
""");
10431043

1044-
SnapshotExtensions.MatchSnapshot(result);
1044+
result.MatchSnapshot();
10451045
}
10461046

10471047
[Fact]
@@ -1093,7 +1093,7 @@ public async Task Payload_Override_With_Errors_Execution_On_Success()
10931093
}
10941094
""");
10951095

1096-
SnapshotExtensions.MatchSnapshot(result);
1096+
result.MatchSnapshot();
10971097
}
10981098

10991099
[Fact]
@@ -1117,7 +1117,7 @@ public async Task Payload_Override_With_Errors_Execution_On_Error()
11171117
}
11181118
""");
11191119

1120-
SnapshotExtensions.MatchSnapshot(result);
1120+
result.MatchSnapshot();
11211121
}
11221122

11231123
[Fact]
@@ -1170,7 +1170,7 @@ public async Task Mutation_Aggregate_Error_Not_Mapped()
11701170
}
11711171
""");
11721172

1173-
SnapshotExtensions.MatchSnapshot(result);
1173+
result.MatchSnapshot();
11741174
}
11751175

11761176
[Fact]

src/HotChocolate/Core/test/Types.Tests/SchemaBuilderTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2088,7 +2088,7 @@ public async Task Ensure_Types_Are_Bound_Explicitly()
20882088
.ModifyOptions(options => options.DefaultBindingBehavior = BindingBehavior.Explicit)
20892089
.BuildSchemaAsync();
20902090

2091-
SnapshotExtensions.MatchSnapshot(schema);
2091+
schema.MatchSnapshot();
20922092
}
20932093

20942094
public interface IMockConvention : IConvention

src/HotChocolate/Core/test/Types.Tests/Types/ObjectTypeExtensionTests.cs

+11-11
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ public async Task Static_Query_Extensions()
607607
.AddTypeExtension(typeof(StaticExtensions))
608608
.ExecuteRequestAsync("{ hello }");
609609

610-
SnapshotExtensions.MatchSnapshot(result);
610+
result.MatchSnapshot();
611611
}
612612

613613
[Fact]
@@ -620,7 +620,7 @@ public async Task Static_Query_Extensions_Schema()
620620
.AddTypeExtension(typeof(StaticExtensions))
621621
.BuildSchemaAsync();
622622

623-
SnapshotExtensions.MatchSnapshot(schema);
623+
schema.MatchSnapshot();
624624
}
625625

626626
[Fact]
@@ -633,7 +633,7 @@ public async Task Query_Extension_With_Static_Members_Schema()
633633
.AddTypeExtension<QueryExtensionWithStaticField>()
634634
.BuildSchemaAsync();
635635

636-
SnapshotExtensions.MatchSnapshot(schema);
636+
schema.MatchSnapshot();
637637
}
638638

639639
[Fact]
@@ -647,7 +647,7 @@ public async Task Query_Extension_With_Static_Members_2_Schema()
647647
.ModifyOptions(t => t.DefaultFieldBindingFlags = InstanceAndStatic)
648648
.BuildSchemaAsync();
649649

650-
SnapshotExtensions.MatchSnapshot(schema);
650+
schema.MatchSnapshot();
651651
}
652652

653653
[Fact]
@@ -660,7 +660,7 @@ public async Task Query_Extension_With_Static_Members_Execute()
660660
.AddTypeExtension<QueryExtensionWithStaticField>()
661661
.ExecuteRequestAsync("{ hello }");
662662

663-
SnapshotExtensions.MatchSnapshot(result);
663+
result.MatchSnapshot();
664664
}
665665

666666
[Fact]
@@ -673,7 +673,7 @@ public async Task Query_Extension_With_Static_Members_And_Generic_Schema()
673673
.AddTypeExtension(typeof(StaticFooQueryExtensions))
674674
.BuildSchemaAsync();
675675

676-
SnapshotExtensions.MatchSnapshot(schema);
676+
schema.MatchSnapshot();
677677
}
678678

679679
[Fact]
@@ -686,7 +686,7 @@ public async Task Query_Extension_With_Static_Members_And_Generic()
686686
.AddTypeExtension(typeof(StaticFooQueryExtensions))
687687
.ExecuteRequestAsync("{ hello }");
688688

689-
SnapshotExtensions.MatchSnapshot(result);
689+
result.MatchSnapshot();
690690
}
691691

692692
[Fact]
@@ -699,7 +699,7 @@ public async Task ExtendObjectTypeAttribute_Extends_SchemaType()
699699
.AddTypeExtension<QueryExtensions>()
700700
.BuildSchemaAsync();
701701

702-
SnapshotExtensions.MatchSnapshot(schema);
702+
schema.MatchSnapshot();
703703
}
704704

705705
[Fact]
@@ -713,7 +713,7 @@ public async Task AddObjectTypeExtension1_Extends_SchemaType()
713713
d => d.ExtendsType<QueryType>().Field("foo").Type<IntType>())
714714
.BuildSchemaAsync();
715715

716-
SnapshotExtensions.MatchSnapshot(schema);
716+
schema.MatchSnapshot();
717717
}
718718

719719
[Fact]
@@ -727,7 +727,7 @@ public async Task AddObjectTypeExtension2_Extends_SchemaType()
727727
d => d.Field("foo").Type<IntType>())
728728
.BuildSchemaAsync();
729729

730-
SnapshotExtensions.MatchSnapshot(schema);
730+
schema.MatchSnapshot();
731731
}
732732

733733
[Fact]
@@ -742,7 +742,7 @@ public async Task AddObjectTypeExtension3_Extends_SchemaType()
742742
d => d.Field("foo").Type<IntType>())
743743
.BuildSchemaAsync();
744744

745-
SnapshotExtensions.MatchSnapshot(schema);
745+
schema.MatchSnapshot();
746746
}
747747

748748
public class FooType : ObjectType<Foo>

0 commit comments

Comments
 (0)