-
Notifications
You must be signed in to change notification settings - Fork 262
/
SuiteLifeCycleTests.cs
1711 lines (1455 loc) · 124 KB
/
SuiteLifeCycleTests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Linq;
using FluentAssertions;
using Microsoft.MSTestV2.CLIAutomation;
namespace MSTest.VstestConsoleWrapper.IntegrationTests;
public class SuiteLifeCycleTests : CLITestBase
{
private const string TestAssetName = "SuiteLifeCycleTestProject";
public void ValidateTestRunLifecycle_net6()
{
ValidateTestRunLifecycle("net6.0");
}
public void ValidateTestRunLifecycle_net462()
{
ValidateTestRunLifecycle("net462");
}
public void ValidateInheritanceBehavior()
{
InvokeVsTestForExecution(
new[] { TestAssetName },
testCaseFilter: "FullyQualifiedName~LifecycleInheritance",
targetFramework: "net462");
RunEventsHandler.PassedTests.Should().HaveCount(10);
var testMethod1 = RunEventsHandler.PassedTests.Single(x => x.TestCase.FullyQualifiedName.EndsWith("TestClassDerived_EndOfClass.TestMethod"));
testMethod1.Messages[0].Text.Should().Be(
"""
Console: AssemblyInit was called
TestClassBaseEndOfClass: ClassInitialize
TestClassDerived_EndOfClass: TestMethod
TestClassBaseEndOfClass: ClassCleanup
""");
var testMethod2 = RunEventsHandler.PassedTests.Single(x => x.TestCase.FullyQualifiedName.EndsWith("TestClassDerived_EndOfAssembly.TestMethod"));
testMethod2.Messages[0].Text.Should().Be(
"""
TestClassBaseEndOfAssembly: ClassInitialize
TestClassDerived_EndOfAssembly: TestMethod
""");
var testMethod3 = RunEventsHandler.PassedTests.Single(x => x.TestCase.FullyQualifiedName.EndsWith("TestClassDerivedEndOfClass_EndOfClassEndOfClass.TestMethod"));
testMethod3.Messages[0].Text.Should().Be(
"""
TestClassBaseEndOfClass: ClassInitialize
TestClassIntermediateEndOfClassBaseEndOfClass: ClassInitialize
TestClassDerivedEndOfClass_EndOfClassEndOfClass: TestMethod
TestClassDerivedEndOfClass_EndOfClassEndOfClass: ClassCleanup
TestClassIntermediateEndOfClassBaseEndOfClass: ClassCleanup
TestClassBaseEndOfClass: ClassCleanup
""");
var testMethod4 = RunEventsHandler.PassedTests.Single(x => x.TestCase.FullyQualifiedName.EndsWith("TestClassDerived_EndOfClassEndOfClass.TestMethod"));
testMethod4.Messages[0].Text.Should().Be(
"""
TestClassBaseEndOfClass: ClassInitialize
TestClassIntermediateEndOfClassBaseEndOfClass: ClassInitialize
TestClassDerived_EndOfClassEndOfClass: TestMethod
TestClassIntermediateEndOfClassBaseEndOfClass: ClassCleanup
TestClassBaseEndOfClass: ClassCleanup
""");
var testMethod5 = RunEventsHandler.PassedTests.Single(x => x.TestCase.FullyQualifiedName.EndsWith("TestClassDerivedEndOfClass_EndOfClassEndOfAssembly.TestMethod"));
testMethod5.Messages[0].Text.Should().Be(
"""
TestClassBaseEndOfAssembly: ClassInitialize
TestClassIntermediateEndOfClassBaseEndOfAssembly: ClassInitialize
TestClassDerivedEndOfClass_EndOfClassEndOfAssembly: TestMethod
TestClassDerivedEndOfClass_EndOfClassEndOfAssembly: ClassCleanup
TestClassIntermediateEndOfClassBaseEndOfAssembly: ClassCleanup
TestClassBaseEndOfAssembly: ClassCleanup
""");
var testMethod6 = RunEventsHandler.PassedTests.Single(x => x.TestCase.FullyQualifiedName.EndsWith("TestClassDerived_EndOfClassEndOfAssembly.TestMethod"));
testMethod6.Messages[0].Text.Should().Be(
"""
TestClassBaseEndOfAssembly: ClassInitialize
TestClassIntermediateEndOfClassBaseEndOfAssembly: ClassInitialize
TestClassDerived_EndOfClassEndOfAssembly: TestMethod
TestClassIntermediateEndOfClassBaseEndOfAssembly: ClassCleanup
TestClassBaseEndOfAssembly: ClassCleanup
""");
var testMethod7 = RunEventsHandler.PassedTests.Single(x => x.TestCase.FullyQualifiedName.EndsWith("TestClassDerivedEndOfClass_EndOfAssemblyEndOfClass.TestMethod"));
testMethod7.Messages[0].Text.Should().Be(
"""
TestClassBaseEndOfClass: ClassInitialize
TestClassIntermediateEndOfAssemblyBaseEndOfClass: ClassInitialize
TestClassDerivedEndOfClass_EndOfAssemblyEndOfClass: TestMethod
TestClassDerivedEndOfClass_EndOfAssemblyEndOfClass: ClassCleanup
TestClassIntermediateEndOfAssemblyBaseEndOfClass: ClassCleanup
TestClassBaseEndOfClass: ClassCleanup
""");
var testMethod8 = RunEventsHandler.PassedTests.Single(x => x.TestCase.FullyQualifiedName.EndsWith("TestClassDerived_EndOfAssemblyEndOfClass.TestMethod"));
testMethod8.Messages[0].Text.Should().Be(
"""
TestClassBaseEndOfClass: ClassInitialize
TestClassIntermediateEndOfAssemblyBaseEndOfClass: ClassInitialize
TestClassDerived_EndOfAssemblyEndOfClass: TestMethod
TestClassIntermediateEndOfAssemblyBaseEndOfClass: ClassCleanup
TestClassBaseEndOfClass: ClassCleanup
""");
var testMethod9 = RunEventsHandler.PassedTests.Single(x => x.TestCase.FullyQualifiedName.EndsWith("TestClassDerivedEndOfClass_EndOfAssemblyEndOfAssembly.TestMethod"));
testMethod9.Messages[0].Text.Should().Be(
"""
TestClassBaseEndOfAssembly: ClassInitialize
TestClassIntermediateEndOfAssemblyBaseEndOfAssembly: ClassInitialize
TestClassDerivedEndOfClass_EndOfAssemblyEndOfAssembly: TestMethod
TestClassDerivedEndOfClass_EndOfAssemblyEndOfAssembly: ClassCleanup
TestClassIntermediateEndOfAssemblyBaseEndOfAssembly: ClassCleanup
TestClassBaseEndOfAssembly: ClassCleanup
""");
var testMethod10 = RunEventsHandler.PassedTests.Single(x => x.TestCase.FullyQualifiedName.EndsWith("TestClassDerived_EndOfAssemblyEndOfAssembly.TestMethod"));
testMethod10.Messages[0].Text.Should().Be(
"""
TestClassBaseEndOfAssembly: ClassInitialize
TestClassIntermediateEndOfAssemblyBaseEndOfAssembly: ClassInitialize
TestClassDerived_EndOfAssemblyEndOfAssembly: TestMethod
TestClassIntermediateEndOfAssemblyBaseEndOfAssembly: ClassCleanup
TestClassBaseEndOfAssembly: ClassCleanup
TestClassBaseEndOfAssembly: ClassCleanup
Console: AssemblyCleanup was called
""");
}
private void ValidateTestRunLifecycle(string targetFramework)
{
InvokeVsTestForExecution(
new[] { TestAssetName },
testCaseFilter: "FullyQualifiedName~SuiteLifeCycleTestProject",
targetFramework: targetFramework);
RunEventsHandler.PassedTests.Should().HaveCount(27); // The inherit class tests are called twice.
// The cleanup will appear in this case as the default ClassCleanup is EndOfClass.
var caseClassCleanup = RunEventsHandler.PassedTests.Single(x => x.TestCase.FullyQualifiedName.Contains("LifeCycleClassCleanup.TestMethod"));
caseClassCleanup.Outcome.Should().Be(Microsoft.VisualStudio.TestPlatform.ObjectModel.TestOutcome.Passed);
caseClassCleanup.Messages.Should().HaveCount(3);
caseClassCleanup.Messages[0].Text.Should().Be(
$"""
Console: AssemblyInit was called
Console: LifeCycleClassCleanup.ClassInitialize was called
Console: LifeCycleClassCleanup.ctor was called
Console: LifeCycleClassCleanup.TestInitialize was called
Console: LifeCycleClassCleanup.TestMethod was called
Console: LifeCycleClassCleanup.TestCleanup was called
{(targetFramework == "net6.0"
? "Console: LifeCycleClassCleanup.DisposeAsync was called\r\nConsole: LifeCycleClassCleanup.Dispose was called"
: "Console: LifeCycleClassCleanup.Dispose was called")}
Console: LifeCycleClassCleanup.ClassCleanup was called
""");
caseClassCleanup.Messages[1].Text.Should().Be(
$"""
Debug Trace:
{GenerateTraceDebugPrefixedMessage("AssemblyInit was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanup.ClassInitialize was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanup.ctor was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanup.TestInitialize was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanup.TestMethod was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanup.TestCleanup was called")}
{(targetFramework == "net6.0"
? GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanup.DisposeAsync was called")
+ "\r\n"
+ GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanup.Dispose was called")
: GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanup.Dispose was called"))}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanup.ClassCleanup was called")}
""");
caseClassCleanup.Messages[2].Text.Should().Be(
$"""
TestContext Messages:
AssemblyInit was called
LifeCycleClassCleanup.ClassInitialize was called
LifeCycleClassCleanup.ctor was called
LifeCycleClassCleanup.TestInitialize was called
LifeCycleClassCleanup.TestMethod was called
LifeCycleClassCleanup.TestCleanup was called
{(targetFramework == "net6.0"
? "LifeCycleClassCleanup.DisposeAsync was called\r\nLifeCycleClassCleanup.Dispose was called"
: "LifeCycleClassCleanup.Dispose was called")}
LifeCycleClassCleanup.ClassCleanup was called
""");
var caseClassCleanupEndOfAssembly = RunEventsHandler.PassedTests.Single(x => x.TestCase.FullyQualifiedName.Contains("LifeCycleClassCleanupEndOfAssembly.TestMethod"));
caseClassCleanupEndOfAssembly.Outcome.Should().Be(Microsoft.VisualStudio.TestPlatform.ObjectModel.TestOutcome.Passed);
// We don't see "LifeCycleClassCleanupEndOfAssembly.ClassCleanup was called" because it will be attached to the
// latest test run.
caseClassCleanupEndOfAssembly.Messages.Should().HaveCount(3);
caseClassCleanupEndOfAssembly.Messages[0].Text.Should().Be(
$"""
Console: LifeCycleClassCleanupEndOfAssembly.ClassInitialize was called
Console: LifeCycleClassCleanupEndOfAssembly.ctor was called
Console: LifeCycleClassCleanupEndOfAssembly.TestInitialize was called
Console: LifeCycleClassCleanupEndOfAssembly.TestMethod was called
Console: LifeCycleClassCleanupEndOfAssembly.TestCleanup was called
{(targetFramework == "net6.0"
? "Console: LifeCycleClassCleanupEndOfAssembly.DisposeAsync was called\r\nConsole: LifeCycleClassCleanupEndOfAssembly.Dispose was called"
: "Console: LifeCycleClassCleanupEndOfAssembly.Dispose was called")}
""");
caseClassCleanupEndOfAssembly.Messages[1].Text.Should().Be(
$"""
Debug Trace:
{GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanupEndOfAssembly.ClassInitialize was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanupEndOfAssembly.ctor was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanupEndOfAssembly.TestInitialize was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanupEndOfAssembly.TestMethod was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanupEndOfAssembly.TestCleanup was called")}
{(targetFramework == "net6.0"
? GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanupEndOfAssembly.DisposeAsync was called")
+ "\r\n"
+ GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanupEndOfAssembly.Dispose was called")
: GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanupEndOfAssembly.Dispose was called"))}
""");
caseClassCleanupEndOfAssembly.Messages[2].Text.Should().Be(
$"""
TestContext Messages:
LifeCycleClassCleanupEndOfAssembly.ClassInitialize was called
LifeCycleClassCleanupEndOfAssembly.ctor was called
LifeCycleClassCleanupEndOfAssembly.TestInitialize was called
LifeCycleClassCleanupEndOfAssembly.TestMethod was called
LifeCycleClassCleanupEndOfAssembly.TestCleanup was called
{(targetFramework == "net6.0"
? "LifeCycleClassCleanupEndOfAssembly.DisposeAsync was called\r\nLifeCycleClassCleanupEndOfAssembly.Dispose was called"
: "LifeCycleClassCleanupEndOfAssembly.Dispose was called")}
""");
var caseClassCleanupEndOfClass = RunEventsHandler.PassedTests.Single(x => x.TestCase.FullyQualifiedName.Contains("LifeCycleClassCleanupEndOfClass.TestMethod"));
caseClassCleanupEndOfClass.Outcome.Should().Be(Microsoft.VisualStudio.TestPlatform.ObjectModel.TestOutcome.Passed);
caseClassCleanupEndOfClass.Messages.Should().HaveCount(3);
caseClassCleanupEndOfClass.Messages[0].Text.Should().Be(
$"""
Console: LifeCycleClassCleanupEndOfClass.ClassInitialize was called
Console: LifeCycleClassCleanupEndOfClass.ctor was called
Console: LifeCycleClassCleanupEndOfClass.TestInitialize was called
Console: LifeCycleClassCleanupEndOfClass.TestMethod was called
Console: LifeCycleClassCleanupEndOfClass.TestCleanup was called
{(targetFramework == "net6.0"
? "Console: LifeCycleClassCleanupEndOfClass.DisposeAsync was called\r\nConsole: LifeCycleClassCleanupEndOfClass.Dispose was called"
: "Console: LifeCycleClassCleanupEndOfClass.Dispose was called")}
Console: LifeCycleClassCleanupEndOfClass.ClassCleanup was called
""");
caseClassCleanupEndOfClass.Messages[1].Text.Should().Be(
$"""
Debug Trace:
{GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanupEndOfClass.ClassInitialize was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanupEndOfClass.ctor was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanupEndOfClass.TestInitialize was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanupEndOfClass.TestMethod was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanupEndOfClass.TestCleanup was called")}
{(targetFramework == "net6.0"
? GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanupEndOfClass.DisposeAsync was called")
+ "\r\n"
+ GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanupEndOfClass.Dispose was called")
: GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanupEndOfClass.Dispose was called"))}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanupEndOfClass.ClassCleanup was called")}
""");
caseClassCleanupEndOfClass.Messages[2].Text.Should().Be(
$"""
TestContext Messages:
LifeCycleClassCleanupEndOfClass.ClassInitialize was called
LifeCycleClassCleanupEndOfClass.ctor was called
LifeCycleClassCleanupEndOfClass.TestInitialize was called
LifeCycleClassCleanupEndOfClass.TestMethod was called
LifeCycleClassCleanupEndOfClass.TestCleanup was called
{(targetFramework == "net6.0"
? "LifeCycleClassCleanupEndOfClass.DisposeAsync was called\r\nLifeCycleClassCleanupEndOfClass.Dispose was called"
: "LifeCycleClassCleanupEndOfClass.Dispose was called")}
LifeCycleClassCleanupEndOfClass.ClassCleanup was called
""");
var caseClassInitializeAndCleanupBeforeEachDerivedClass = RunEventsHandler.PassedTests.Single(x => x.TestCase.FullyQualifiedName.Contains("LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.TestMethod"));
caseClassInitializeAndCleanupBeforeEachDerivedClass.Outcome.Should().Be(Microsoft.VisualStudio.TestPlatform.ObjectModel.TestOutcome.Passed);
caseClassInitializeAndCleanupBeforeEachDerivedClass.Messages.Should().HaveCount(3);
caseClassInitializeAndCleanupBeforeEachDerivedClass.Messages[0].Text.Should().Be(
$"""
Console: LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.ClassInitialize was called
Console: LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.ctor was called
Console: LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.TestInitialize was called
Console: LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.TestMethod was called
Console: LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.TestCleanup was called
{(targetFramework == "net6.0"
? "Console: LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.DisposeAsync was called\r\nConsole: LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.Dispose was called"
: "Console: LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.Dispose was called")}
""");
caseClassInitializeAndCleanupBeforeEachDerivedClass.Messages[1].Text.Should().Be(
$"""
Debug Trace:
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.ClassInitialize was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.ctor was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.TestInitialize was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.TestMethod was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.TestCleanup was called")}
{(targetFramework == "net6.0"
? GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.DisposeAsync was called")
+ "\r\n"
+ GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.Dispose was called")
: GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.Dispose was called"))}
""");
caseClassInitializeAndCleanupBeforeEachDerivedClass.Messages[2].Text.Should().Be(
$"""
TestContext Messages:
LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.ClassInitialize was called
LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.ctor was called
LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.TestInitialize was called
LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.TestMethod was called
LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.TestCleanup was called
{(targetFramework == "net6.0"
? "LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.DisposeAsync was called\r\nLifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.Dispose was called"
: "LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.Dispose was called")}
""");
var caseClassInitializeAndCleanupNone = RunEventsHandler.PassedTests.Single(x => x.TestCase.FullyQualifiedName.Contains("LifeCycleClassInitializeAndCleanupNone.TestMethod"));
caseClassInitializeAndCleanupNone.Outcome.Should().Be(Microsoft.VisualStudio.TestPlatform.ObjectModel.TestOutcome.Passed);
caseClassInitializeAndCleanupNone.Messages.Should().HaveCount(3);
caseClassInitializeAndCleanupNone.Messages[0].Text.Should().Be(
$"""
Console: LifeCycleClassInitializeAndCleanupNone.ClassInitialize was called
Console: LifeCycleClassInitializeAndCleanupNone.ctor was called
Console: LifeCycleClassInitializeAndCleanupNone.TestInitialize was called
Console: LifeCycleClassInitializeAndCleanupNone.TestMethod was called
Console: LifeCycleClassInitializeAndCleanupNone.TestCleanup was called
{(targetFramework == "net6.0"
? "Console: LifeCycleClassInitializeAndCleanupNone.DisposeAsync was called\r\nConsole: LifeCycleClassInitializeAndCleanupNone.Dispose was called"
: "Console: LifeCycleClassInitializeAndCleanupNone.Dispose was called")}
""");
caseClassInitializeAndCleanupNone.Messages[1].Text.Should().Be(
$"""
Debug Trace:
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupNone.ClassInitialize was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupNone.ctor was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupNone.TestInitialize was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupNone.TestMethod was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupNone.TestCleanup was called")}
{(targetFramework == "net6.0"
? GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupNone.DisposeAsync was called")
+ "\r\n"
+ GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupNone.Dispose was called")
: GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupNone.Dispose was called"))}
""");
caseClassInitializeAndCleanupNone.Messages[2].Text.Should().Be(
$"""
TestContext Messages:
LifeCycleClassInitializeAndCleanupNone.ClassInitialize was called
LifeCycleClassInitializeAndCleanupNone.ctor was called
LifeCycleClassInitializeAndCleanupNone.TestInitialize was called
LifeCycleClassInitializeAndCleanupNone.TestMethod was called
LifeCycleClassInitializeAndCleanupNone.TestCleanup was called
{(targetFramework == "net6.0"
? "LifeCycleClassInitializeAndCleanupNone.DisposeAsync was called\r\nLifeCycleClassInitializeAndCleanupNone.Dispose was called"
: "LifeCycleClassInitializeAndCleanupNone.Dispose was called")}
""");
var caseClassInitializeBeforeEachDerivedClassAndClassCleanupNone = RunEventsHandler.PassedTests.Single(x => x.TestCase.FullyQualifiedName.Contains("LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone"));
caseClassInitializeBeforeEachDerivedClassAndClassCleanupNone.Outcome.Should().Be(Microsoft.VisualStudio.TestPlatform.ObjectModel.TestOutcome.Passed);
caseClassInitializeBeforeEachDerivedClassAndClassCleanupNone.Messages.Should().HaveCount(3);
caseClassInitializeBeforeEachDerivedClassAndClassCleanupNone.Messages[0].Text.Should().Be(
$"""
Console: LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.ClassInitialize was called
Console: LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.ctor was called
Console: LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestInitialize was called
Console: LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestMethod was called
Console: LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestCleanup was called
{(targetFramework == "net6.0"
? "Console: LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.DisposeAsync was called\r\nConsole: LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.Dispose was called"
: "Console: LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.Dispose was called")}
""");
caseClassInitializeBeforeEachDerivedClassAndClassCleanupNone.Messages[1].Text.Should().Be(
$"""
Debug Trace:
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.ClassInitialize was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.ctor was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestInitialize was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestMethod was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestCleanup was called")}
{(targetFramework == "net6.0"
? GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.DisposeAsync was called")
+ "\r\n"
+ GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.Dispose was called")
: GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.Dispose was called"))}
""");
caseClassInitializeBeforeEachDerivedClassAndClassCleanupNone.Messages[2].Text.Should().Be(
$"""
TestContext Messages:
LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.ClassInitialize was called
LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.ctor was called
LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestInitialize was called
LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestMethod was called
LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestCleanup was called
{(targetFramework == "net6.0"
? "LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.DisposeAsync was called\r\nLifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.Dispose was called"
: "LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.Dispose was called")}
""");
var caseClassInitializeNoneAndClassCleanupBeforeEachDerivedClass = RunEventsHandler.PassedTests.Single(x => x.TestCase.FullyQualifiedName.Contains("LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass"));
caseClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.Outcome.Should().Be(Microsoft.VisualStudio.TestPlatform.ObjectModel.TestOutcome.Passed);
caseClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.Messages.Should().HaveCount(3);
caseClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.Messages[0].Text.Should().Be(
$"""
Console: LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.ClassInitialize was called
Console: LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.ctor was called
Console: LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.TestInitialize was called
Console: LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.TestMethod was called
Console: LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.TestCleanup was called
{(targetFramework == "net6.0"
? "Console: LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.DisposeAsync was called\r\nConsole: LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.Dispose was called"
: "Console: LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.Dispose was called")}
""");
caseClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.Messages[1].Text.Should().Be(
$"""
Debug Trace:
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.ClassInitialize was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.ctor was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.TestInitialize was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.TestMethod was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.TestCleanup was called")}
{(targetFramework == "net6.0"
? GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.DisposeAsync was called")
+ "\r\n"
+ GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.Dispose was called")
: GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.Dispose was called"))}
""");
caseClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.Messages[2].Text.Should().Be(
$"""
TestContext Messages:
LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.ClassInitialize was called
LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.ctor was called
LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.TestInitialize was called
LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.TestMethod was called
LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.TestCleanup was called
{(targetFramework == "net6.0"
? "LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.DisposeAsync was called\r\nLifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.Dispose was called"
: "LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.Dispose was called")}
""");
var caseDerivedClassInitializeAndCleanupBeforeEachDerivedClass = RunEventsHandler.PassedTests.Single(x => x.TestCase.FullyQualifiedName.Contains("LifeCycleDerivedClassInitializeAndCleanupBeforeEachDerivedClass.DerivedClassTestMethod"));
caseDerivedClassInitializeAndCleanupBeforeEachDerivedClass.Outcome.Should().Be(Microsoft.VisualStudio.TestPlatform.ObjectModel.TestOutcome.Passed);
caseDerivedClassInitializeAndCleanupBeforeEachDerivedClass.Messages.Should().HaveCount(3);
caseDerivedClassInitializeAndCleanupBeforeEachDerivedClass.Messages[0].Text.Should().Be(
$"""
Console: LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.ClassInitialize was called
Console: LifeCycleDerivedClassInitializeAndCleanupBeforeEachDerivedClass.ClassInitialize was called
Console: LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.ctor was called
Console: LifeCycleDerivedClassInitializeAndCleanupBeforeEachDerivedClass.ctor was called
Console: LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.TestInitialize was called
Console: LifeCycleDerivedClassInitializeAndCleanupBeforeEachDerivedClass.TestInitialize was called
Console: LifeCycleDerivedClassInitializeAndCleanupBeforeEachDerivedClass.TestMethod was called
Console: LifeCycleDerivedClassInitializeAndCleanupBeforeEachDerivedClass.TestCleanup was called
Console: LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.TestCleanup was called
{(targetFramework == "net6.0"
? "Console: LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.DisposeAsync was called\r\nConsole: LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.Dispose was called"
: "Console: LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.Dispose was called")}
""");
caseDerivedClassInitializeAndCleanupBeforeEachDerivedClass.Messages[1].Text.Should().Be(
$"""
Debug Trace:
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.ClassInitialize was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleDerivedClassInitializeAndCleanupBeforeEachDerivedClass.ClassInitialize was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.ctor was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleDerivedClassInitializeAndCleanupBeforeEachDerivedClass.ctor was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.TestInitialize was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleDerivedClassInitializeAndCleanupBeforeEachDerivedClass.TestInitialize was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleDerivedClassInitializeAndCleanupBeforeEachDerivedClass.TestMethod was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleDerivedClassInitializeAndCleanupBeforeEachDerivedClass.TestCleanup was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.TestCleanup was called")}
{(targetFramework == "net6.0"
? GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.DisposeAsync was called")
+ "\r\n"
+ GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.Dispose was called")
: GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.Dispose was called"))}
""");
caseDerivedClassInitializeAndCleanupBeforeEachDerivedClass.Messages[2].Text.Should().Be(
$"""
TestContext Messages:
LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.ClassInitialize was called
LifeCycleDerivedClassInitializeAndCleanupBeforeEachDerivedClass.ClassInitialize was called
LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.ctor was called
LifeCycleDerivedClassInitializeAndCleanupBeforeEachDerivedClass.ctor was called
LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.TestInitialize was called
LifeCycleDerivedClassInitializeAndCleanupBeforeEachDerivedClass.TestInitialize was called
LifeCycleDerivedClassInitializeAndCleanupBeforeEachDerivedClass.TestMethod was called
LifeCycleDerivedClassInitializeAndCleanupBeforeEachDerivedClass.TestCleanup was called
LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.TestCleanup was called
{(targetFramework == "net6.0"
? "LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.DisposeAsync was called\r\nLifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.Dispose was called"
: "LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.Dispose was called")}
""");
// Test the parent test method.
var caseDerivedClassInitializeAndCleanupBeforeEachDerivedClassParentTestMethod = RunEventsHandler.PassedTests.Single(x => x.TestCase.FullyQualifiedName.Contains("LifeCycleDerivedClassInitializeAndCleanupBeforeEachDerivedClass.TestMethod"));
caseDerivedClassInitializeAndCleanupBeforeEachDerivedClassParentTestMethod.Outcome.Should().Be(Microsoft.VisualStudio.TestPlatform.ObjectModel.TestOutcome.Passed);
caseDerivedClassInitializeAndCleanupBeforeEachDerivedClassParentTestMethod.Messages.Should().HaveCount(3);
caseDerivedClassInitializeAndCleanupBeforeEachDerivedClassParentTestMethod.Messages[0].Text.Should().Be(
$"""
Console: LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.ctor was called
Console: LifeCycleDerivedClassInitializeAndCleanupBeforeEachDerivedClass.ctor was called
Console: LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.TestInitialize was called
Console: LifeCycleDerivedClassInitializeAndCleanupBeforeEachDerivedClass.TestInitialize was called
Console: LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.TestMethod was called
Console: LifeCycleDerivedClassInitializeAndCleanupBeforeEachDerivedClass.TestCleanup was called
Console: LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.TestCleanup was called
{(targetFramework == "net6.0"
? "Console: LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.DisposeAsync was called\r\nConsole: LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.Dispose was called"
: "Console: LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.Dispose was called")}
""");
caseDerivedClassInitializeAndCleanupBeforeEachDerivedClassParentTestMethod.Messages[1].Text.Should().Be(
$"""
Debug Trace:
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.ctor was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleDerivedClassInitializeAndCleanupBeforeEachDerivedClass.ctor was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.TestInitialize was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleDerivedClassInitializeAndCleanupBeforeEachDerivedClass.TestInitialize was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.TestMethod was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleDerivedClassInitializeAndCleanupBeforeEachDerivedClass.TestCleanup was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.TestCleanup was called")}
{(targetFramework == "net6.0"
? GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.DisposeAsync was called")
+ "\r\n"
+ GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.Dispose was called")
: GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.Dispose was called"))}
""");
caseDerivedClassInitializeAndCleanupBeforeEachDerivedClassParentTestMethod.Messages[2].Text.Should().Be(
$"""
TestContext Messages:
LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.ctor was called
LifeCycleDerivedClassInitializeAndCleanupBeforeEachDerivedClass.ctor was called
LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.TestInitialize was called
LifeCycleDerivedClassInitializeAndCleanupBeforeEachDerivedClass.TestInitialize was called
LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.TestMethod was called
LifeCycleDerivedClassInitializeAndCleanupBeforeEachDerivedClass.TestCleanup was called
LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.TestCleanup was called
{(targetFramework == "net6.0"
? "LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.DisposeAsync was called\r\nLifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.Dispose was called"
: "LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.Dispose was called")}
""");
var caseDerivedClassInitializeAndCleanupNone = RunEventsHandler.PassedTests.Single(x => x.TestCase.FullyQualifiedName.Contains("LifeCycleDerivedClassInitializeAndCleanupNone.DerivedClassTestMethod"));
caseDerivedClassInitializeAndCleanupNone.Outcome.Should().Be(Microsoft.VisualStudio.TestPlatform.ObjectModel.TestOutcome.Passed);
caseDerivedClassInitializeAndCleanupNone.Messages.Should().HaveCount(3);
caseDerivedClassInitializeAndCleanupNone.Messages[0].Text.Should().Be(
$"""
Console: LifeCycleDerivedClassInitializeAndCleanupNone.ClassInitialize was called
Console: LifeCycleClassInitializeAndCleanupNone.ctor was called
Console: LifeCycleDerivedClassInitializeAndCleanupNone.ctor was called
Console: LifeCycleClassInitializeAndCleanupNone.TestInitialize was called
Console: LifeCycleDerivedClassInitializeAndCleanupNone.TestInitialize was called
Console: LifeCycleDerivedClassInitializeAndCleanupNone.TestMethod was called
Console: LifeCycleDerivedClassInitializeAndCleanupNone.TestCleanup was called
Console: LifeCycleClassInitializeAndCleanupNone.TestCleanup was called
{(targetFramework == "net6.0"
? "Console: LifeCycleClassInitializeAndCleanupNone.DisposeAsync was called\r\nConsole: LifeCycleClassInitializeAndCleanupNone.Dispose was called"
: "Console: LifeCycleClassInitializeAndCleanupNone.Dispose was called")}
""");
caseDerivedClassInitializeAndCleanupNone.Messages[1].Text.Should().Be(
$"""
Debug Trace:
{GenerateTraceDebugPrefixedMessage("LifeCycleDerivedClassInitializeAndCleanupNone.ClassInitialize was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupNone.ctor was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleDerivedClassInitializeAndCleanupNone.ctor was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupNone.TestInitialize was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleDerivedClassInitializeAndCleanupNone.TestInitialize was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleDerivedClassInitializeAndCleanupNone.TestMethod was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleDerivedClassInitializeAndCleanupNone.TestCleanup was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupNone.TestCleanup was called")}
{(targetFramework == "net6.0"
? GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupNone.DisposeAsync was called")
+ "\r\n"
+ GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupNone.Dispose was called")
: GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupNone.Dispose was called"))}
""");
caseDerivedClassInitializeAndCleanupNone.Messages[2].Text.Should().Be(
$"""
TestContext Messages:
LifeCycleDerivedClassInitializeAndCleanupNone.ClassInitialize was called
LifeCycleClassInitializeAndCleanupNone.ctor was called
LifeCycleDerivedClassInitializeAndCleanupNone.ctor was called
LifeCycleClassInitializeAndCleanupNone.TestInitialize was called
LifeCycleDerivedClassInitializeAndCleanupNone.TestInitialize was called
LifeCycleDerivedClassInitializeAndCleanupNone.TestMethod was called
LifeCycleDerivedClassInitializeAndCleanupNone.TestCleanup was called
LifeCycleClassInitializeAndCleanupNone.TestCleanup was called
{(targetFramework == "net6.0"
? "LifeCycleClassInitializeAndCleanupNone.DisposeAsync was called\r\nLifeCycleClassInitializeAndCleanupNone.Dispose was called"
: "LifeCycleClassInitializeAndCleanupNone.Dispose was called")}
""");
// Test the parent test method.
var caseDerivedClassInitializeAndCleanupNoneParentTestMethod = RunEventsHandler.PassedTests.Single(x => x.TestCase.FullyQualifiedName.Contains("LifeCycleDerivedClassInitializeAndCleanupNone.TestMethod"));
caseDerivedClassInitializeAndCleanupNoneParentTestMethod.Outcome.Should().Be(Microsoft.VisualStudio.TestPlatform.ObjectModel.TestOutcome.Passed);
caseDerivedClassInitializeAndCleanupNoneParentTestMethod.Messages.Should().HaveCount(3);
caseDerivedClassInitializeAndCleanupNoneParentTestMethod.Messages[0].Text.Should().Be(
$"""
Console: LifeCycleClassInitializeAndCleanupNone.ctor was called
Console: LifeCycleDerivedClassInitializeAndCleanupNone.ctor was called
Console: LifeCycleClassInitializeAndCleanupNone.TestInitialize was called
Console: LifeCycleDerivedClassInitializeAndCleanupNone.TestInitialize was called
Console: LifeCycleClassInitializeAndCleanupNone.TestMethod was called
Console: LifeCycleDerivedClassInitializeAndCleanupNone.TestCleanup was called
Console: LifeCycleClassInitializeAndCleanupNone.TestCleanup was called
{(targetFramework == "net6.0"
? "Console: LifeCycleClassInitializeAndCleanupNone.DisposeAsync was called\r\nConsole: LifeCycleClassInitializeAndCleanupNone.Dispose was called"
: "Console: LifeCycleClassInitializeAndCleanupNone.Dispose was called")}
""");
caseDerivedClassInitializeAndCleanupNoneParentTestMethod.Messages[1].Text.Should().Be(
$"""
Debug Trace:
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupNone.ctor was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleDerivedClassInitializeAndCleanupNone.ctor was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupNone.TestInitialize was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleDerivedClassInitializeAndCleanupNone.TestInitialize was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupNone.TestMethod was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleDerivedClassInitializeAndCleanupNone.TestCleanup was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupNone.TestCleanup was called")}
{(targetFramework == "net6.0"
? GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupNone.DisposeAsync was called")
+ "\r\n"
+ GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupNone.Dispose was called")
: GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupNone.Dispose was called"))}
""");
caseDerivedClassInitializeAndCleanupNoneParentTestMethod.Messages[2].Text.Should().Be(
$"""
TestContext Messages:
LifeCycleClassInitializeAndCleanupNone.ctor was called
LifeCycleDerivedClassInitializeAndCleanupNone.ctor was called
LifeCycleClassInitializeAndCleanupNone.TestInitialize was called
LifeCycleDerivedClassInitializeAndCleanupNone.TestInitialize was called
LifeCycleClassInitializeAndCleanupNone.TestMethod was called
LifeCycleDerivedClassInitializeAndCleanupNone.TestCleanup was called
LifeCycleClassInitializeAndCleanupNone.TestCleanup was called
{(targetFramework == "net6.0"
? "LifeCycleClassInitializeAndCleanupNone.DisposeAsync was called\r\nLifeCycleClassInitializeAndCleanupNone.Dispose was called"
: "LifeCycleClassInitializeAndCleanupNone.Dispose was called")}
""");
var caseDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone = RunEventsHandler.PassedTests.Single(x => x.TestCase.FullyQualifiedName.Contains("LifeCycleDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.DerivedClassTestMethod"));
caseDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.Outcome.Should().Be(Microsoft.VisualStudio.TestPlatform.ObjectModel.TestOutcome.Passed);
caseDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.Messages.Should().HaveCount(3);
caseDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.Messages[0].Text.Should().Be(
$"""
Console: LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.ClassInitialize was called
Console: LifeCycleDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.ClassInitialize was called
Console: LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.ctor was called
Console: LifeCycleDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.ctor was called
Console: LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestInitialize was called
Console: LifeCycleDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestInitialize was called
Console: LifeCycleDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestMethod was called
Console: LifeCycleDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestCleanup was called
Console: LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestCleanup was called
{(targetFramework == "net6.0"
? "Console: LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.DisposeAsync was called\r\nConsole: LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.Dispose was called"
: "Console: LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.Dispose was called")}
""");
caseDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.Messages[1].Text.Should().Be(
$"""
Debug Trace:
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.ClassInitialize was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.ClassInitialize was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.ctor was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.ctor was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestInitialize was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestInitialize was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestMethod was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestCleanup was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestCleanup was called")}
{(targetFramework == "net6.0"
? GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.DisposeAsync was called")
+ "\r\n"
+ GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.Dispose was called")
: GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.Dispose was called"))}
""");
caseDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.Messages[2].Text.Should().Be(
$"""
TestContext Messages:
LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.ClassInitialize was called
LifeCycleDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.ClassInitialize was called
LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.ctor was called
LifeCycleDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.ctor was called
LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestInitialize was called
LifeCycleDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestInitialize was called
LifeCycleDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestMethod was called
LifeCycleDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestCleanup was called
LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestCleanup was called
{(targetFramework == "net6.0"
? "LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.DisposeAsync was called\r\nLifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.Dispose was called"
: "LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.Dispose was called")}
""");
// Test the parent test method.
var caseDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNoneParentTestMethod = RunEventsHandler.PassedTests.Single(x => x.TestCase.FullyQualifiedName.Contains("LifeCycleDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestMethod"));
caseDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNoneParentTestMethod.Outcome.Should().Be(Microsoft.VisualStudio.TestPlatform.ObjectModel.TestOutcome.Passed);
caseDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNoneParentTestMethod.Messages.Should().HaveCount(3);
caseDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNoneParentTestMethod.Messages[0].Text.Should().Be(
$"""
Console: LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.ctor was called
Console: LifeCycleDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.ctor was called
Console: LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestInitialize was called
Console: LifeCycleDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestInitialize was called
Console: LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestMethod was called
Console: LifeCycleDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestCleanup was called
Console: LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestCleanup was called
{(targetFramework == "net6.0"
? "Console: LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.DisposeAsync was called\r\nConsole: LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.Dispose was called"
: "Console: LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.Dispose was called")}
""");
caseDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNoneParentTestMethod.Messages[1].Text.Should().Be(
$"""
Debug Trace:
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.ctor was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.ctor was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestInitialize was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestInitialize was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestMethod was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestCleanup was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestCleanup was called")}
{(targetFramework == "net6.0"
? GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.DisposeAsync was called")
+ "\r\n"
+ GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.Dispose was called")
: GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.Dispose was called"))}
""");
caseDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNoneParentTestMethod.Messages[2].Text.Should().Be(
$"""
TestContext Messages:
LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.ctor was called
LifeCycleDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.ctor was called
LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestInitialize was called
LifeCycleDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestInitialize was called
LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestMethod was called
LifeCycleDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestCleanup was called
LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestCleanup was called
{(targetFramework == "net6.0"
? "LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.DisposeAsync was called\r\nLifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.Dispose was called"
: "LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.Dispose was called")}
""");
var caseDerivedClassInitializeNoneAndClassCleanupBeforeEachDerivedClass = RunEventsHandler.PassedTests.Single(x => x.TestCase.FullyQualifiedName.Contains("LifeCycleDerivedClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.DerivedClassTestMethod"));
caseDerivedClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.Outcome.Should().Be(Microsoft.VisualStudio.TestPlatform.ObjectModel.TestOutcome.Passed);
caseDerivedClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.Messages.Should().HaveCount(3);
caseDerivedClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.Messages[0].Text.Should().Be(
$"""
Console: LifeCycleDerivedClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.ClassInitialize was called
Console: LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.ctor was called
Console: LifeCycleDerivedClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.ctor was called
Console: LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.TestInitialize was called
Console: LifeCycleDerivedClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.TestInitialize was called
Console: LifeCycleDerivedClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.TestMethod was called
Console: LifeCycleDerivedClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.TestCleanup was called
Console: LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.TestCleanup was called
{(targetFramework == "net6.0"
? "Console: LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.DisposeAsync was called\r\nConsole: LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.Dispose was called"
: "Console: LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.Dispose was called")}
""");
caseDerivedClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.Messages[1].Text.Should().Be(
$"""
Debug Trace:
{GenerateTraceDebugPrefixedMessage("LifeCycleDerivedClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.ClassInitialize was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.ctor was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleDerivedClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.ctor was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.TestInitialize was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleDerivedClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.TestInitialize was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleDerivedClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.TestMethod was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleDerivedClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.TestCleanup was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.TestCleanup was called")}
{(targetFramework == "net6.0"
? GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.DisposeAsync was called")
+ "\r\n"
+ GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.Dispose was called")
: GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.Dispose was called"))}
""");
caseDerivedClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.Messages[2].Text.Should().Be(
$"""
TestContext Messages:
LifeCycleDerivedClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.ClassInitialize was called
LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.ctor was called
LifeCycleDerivedClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.ctor was called
LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.TestInitialize was called
LifeCycleDerivedClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.TestInitialize was called
LifeCycleDerivedClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.TestMethod was called
LifeCycleDerivedClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.TestCleanup was called
LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.TestCleanup was called
{(targetFramework == "net6.0"
? "LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.DisposeAsync was called\r\nLifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.Dispose was called"
: "LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.Dispose was called")}
""");
var caseClassCleanupEndOfAssemblyAndBeforeEachDerivedClass = RunEventsHandler.PassedTests.Single(x => x.TestCase.FullyQualifiedName.Contains("LifeCycleClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.TestMethod"));
caseClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.Outcome.Should().Be(Microsoft.VisualStudio.TestPlatform.ObjectModel.TestOutcome.Passed);
caseClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.Messages.Should().HaveCount(3);
caseClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.Messages[0].Text.Should().Be(
$"""
Console: LifeCycleClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.ClassInitialize was called
Console: LifeCycleClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.ctor was called
Console: LifeCycleClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.TestInitialize was called
Console: LifeCycleClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.TestMethod was called
Console: LifeCycleClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.TestCleanup was called
{(targetFramework == "net6.0"
? "Console: LifeCycleClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.DisposeAsync was called\r\nConsole: LifeCycleClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.Dispose was called"
: "Console: LifeCycleClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.Dispose was called")}
""");
caseClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.Messages[1].Text.Should().Be(
$"""
Debug Trace:
{GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.ClassInitialize was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.ctor was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.TestInitialize was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.TestMethod was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.TestCleanup was called")}
{(targetFramework == "net6.0"
? GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.DisposeAsync was called")
+ "\r\n"
+ GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.Dispose was called")
: GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.Dispose was called"))}
""");
caseClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.Messages[2].Text.Should().Be(
$"""
TestContext Messages:
LifeCycleClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.ClassInitialize was called
LifeCycleClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.ctor was called
LifeCycleClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.TestInitialize was called
LifeCycleClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.TestMethod was called
LifeCycleClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.TestCleanup was called
{(targetFramework == "net6.0"
? "LifeCycleClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.DisposeAsync was called\r\nLifeCycleClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.Dispose was called"
: "LifeCycleClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.Dispose was called")}
""");
var caseClassCleanupEndOfAssemblyAndNone = RunEventsHandler.PassedTests.Single(x => x.TestCase.FullyQualifiedName.Contains("LifeCycleClassCleanupEndOfAssemblyAndNone.TestMethod"));
caseClassCleanupEndOfAssemblyAndNone.Outcome.Should().Be(Microsoft.VisualStudio.TestPlatform.ObjectModel.TestOutcome.Passed);
caseClassCleanupEndOfAssemblyAndNone.Messages.Should().HaveCount(3);
caseClassCleanupEndOfAssemblyAndNone.Messages[0].Text.Should().Be(
$"""
Console: LifeCycleClassCleanupEndOfAssemblyAndNone.ClassInitialize was called
Console: LifeCycleClassCleanupEndOfAssemblyAndNone.ctor was called
Console: LifeCycleClassCleanupEndOfAssemblyAndNone.TestInitialize was called
Console: LifeCycleClassCleanupEndOfAssemblyAndNone.TestMethod was called
Console: LifeCycleClassCleanupEndOfAssemblyAndNone.TestCleanup was called
{(targetFramework == "net6.0"
? "Console: LifeCycleClassCleanupEndOfAssemblyAndNone.DisposeAsync was called\r\nConsole: LifeCycleClassCleanupEndOfAssemblyAndNone.Dispose was called"
: "Console: LifeCycleClassCleanupEndOfAssemblyAndNone.Dispose was called")}
""");
caseClassCleanupEndOfAssemblyAndNone.Messages[1].Text.Should().Be(
$"""
Debug Trace:
{GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanupEndOfAssemblyAndNone.ClassInitialize was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanupEndOfAssemblyAndNone.ctor was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanupEndOfAssemblyAndNone.TestInitialize was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanupEndOfAssemblyAndNone.TestMethod was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanupEndOfAssemblyAndNone.TestCleanup was called")}
{(targetFramework == "net6.0"
? GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanupEndOfAssemblyAndNone.DisposeAsync was called")
+ "\r\n"
+ GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanupEndOfAssemblyAndNone.Dispose was called")
: GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanupEndOfAssemblyAndNone.Dispose was called"))}
""");
caseClassCleanupEndOfAssemblyAndNone.Messages[2].Text.Should().Be(
$"""
TestContext Messages:
LifeCycleClassCleanupEndOfAssemblyAndNone.ClassInitialize was called
LifeCycleClassCleanupEndOfAssemblyAndNone.ctor was called
LifeCycleClassCleanupEndOfAssemblyAndNone.TestInitialize was called
LifeCycleClassCleanupEndOfAssemblyAndNone.TestMethod was called
LifeCycleClassCleanupEndOfAssemblyAndNone.TestCleanup was called
{(targetFramework == "net6.0"
? "LifeCycleClassCleanupEndOfAssemblyAndNone.DisposeAsync was called\r\nLifeCycleClassCleanupEndOfAssemblyAndNone.Dispose was called"
: "LifeCycleClassCleanupEndOfAssemblyAndNone.Dispose was called")}
""");
var caseClassCleanupEndOfClassAndBeforeEachDerivedClass = RunEventsHandler.PassedTests.Single(x => x.TestCase.FullyQualifiedName.Contains("LifeCycleClassCleanupEndOfClassAndBeforeEachDerivedClass.TestMethod"));