forked from microsoft/testfx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestId.FullyQualifiedStrategy.cs
182 lines (146 loc) · 8.49 KB
/
TestId.FullyQualifiedStrategy.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
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using FluentAssertions;
using Microsoft.MSTestV2.CLIAutomation;
namespace MSTest.IntegrationTests;
public partial class TestId : CLITestBase
{
private const string FullyQualifiedStrategyDll = "TestIdProject.FullyQualifiedStrategy";
public void TestIdUniqueness_DataRowArray_FullyQualifiedStrategy()
{
// Arrange
string assemblyPath = GetAssetFullPath(FullyQualifiedStrategyDll);
// Act
System.Collections.Immutable.ImmutableArray<Microsoft.VisualStudio.TestPlatform.ObjectModel.TestCase> testCases = DiscoverTests(assemblyPath, "FullyQualifiedName~DataRowArraysTests");
System.Collections.Immutable.ImmutableArray<Microsoft.VisualStudio.TestPlatform.ObjectModel.TestResult> testResults = RunTests(testCases);
// Assert
VerifyE2E.FailedTestCount(testResults, 0);
VerifyE2E.TestsPassed(
testResults,
"DataRowArraysTests (0,[])",
"DataRowArraysTests (0,[0])",
"DataRowArraysTests (0,[0,0,0])");
// We cannot assert the expected ID as it is path dependent
testResults.Select(x => x.TestCase.Id.ToString()).Should().OnlyHaveUniqueItems();
}
public void TestIdUniqueness_DataRowString_FullyQualifiedStrategy()
{
// Arrange
string assemblyPath = GetAssetFullPath(FullyQualifiedStrategyDll);
// Act
System.Collections.Immutable.ImmutableArray<Microsoft.VisualStudio.TestPlatform.ObjectModel.TestCase> testCases = DiscoverTests(assemblyPath, "FullyQualifiedName~DataRowStringTests");
System.Collections.Immutable.ImmutableArray<Microsoft.VisualStudio.TestPlatform.ObjectModel.TestResult> testResults = RunTests(testCases);
// Assert
VerifyE2E.FailedTestCount(testResults, 0);
VerifyE2E.TestsPassed(
testResults,
"DataRowStringTests (null)",
"DataRowStringTests (\"\")",
"DataRowStringTests ( )",
"DataRowStringTests ( )");
// We cannot assert the expected ID as it is path dependent
testResults.Select(x => x.TestCase.Id.ToString()).Should().OnlyHaveUniqueItems();
}
public void TestIdUniqueness_DynamicDataArrays_FullyQualifiedStrategy()
{
// Arrange
string assemblyPath = GetAssetFullPath(FullyQualifiedStrategyDll);
// Act
System.Collections.Immutable.ImmutableArray<Microsoft.VisualStudio.TestPlatform.ObjectModel.TestCase> testCases = DiscoverTests(assemblyPath, "FullyQualifiedName~DynamicDataArraysTests");
System.Collections.Immutable.ImmutableArray<Microsoft.VisualStudio.TestPlatform.ObjectModel.TestResult> testResults = RunTests(testCases);
// Assert
VerifyE2E.FailedTestCount(testResults, 0);
VerifyE2E.TestsPassed(
testResults,
"DynamicDataArraysTests (0,System.Int32[])",
"DynamicDataArraysTests (0,System.Int32[])",
"DynamicDataArraysTests (0,System.Int32[])");
// We cannot assert the expected ID as it is path dependent
testResults.Select(x => x.TestCase.Id.ToString()).Should().OnlyHaveUniqueItems();
}
public void TestIdUniqueness_DynamicDataTuple_FullyQualifiedStrategy()
{
// Arrange
string assemblyPath = GetAssetFullPath(FullyQualifiedStrategyDll);
// Act
System.Collections.Immutable.ImmutableArray<Microsoft.VisualStudio.TestPlatform.ObjectModel.TestCase> testCases = DiscoverTests(assemblyPath, "FullyQualifiedName~DynamicDataTuplesTests");
System.Collections.Immutable.ImmutableArray<Microsoft.VisualStudio.TestPlatform.ObjectModel.TestResult> testResults = RunTests(testCases);
// Assert
VerifyE2E.FailedTestCount(testResults, 0);
VerifyE2E.TestsPassed(
testResults,
"DynamicDataTuplesTests ((1, text, True))",
"DynamicDataTuplesTests ((1, text, False))");
// We cannot assert the expected ID as it is path dependent
testResults.Select(x => x.TestCase.Id.ToString()).Should().OnlyHaveUniqueItems();
}
public void TestIdUniqueness_DynamicDataGenericCollections_FullyQualifiedStrategy()
{
// Arrange
string assemblyPath = GetAssetFullPath(FullyQualifiedStrategyDll);
// Act
System.Collections.Immutable.ImmutableArray<Microsoft.VisualStudio.TestPlatform.ObjectModel.TestCase> testCases = DiscoverTests(assemblyPath, "FullyQualifiedName~DynamicDataGenericCollectionsTests");
System.Collections.Immutable.ImmutableArray<Microsoft.VisualStudio.TestPlatform.ObjectModel.TestResult> testResults = RunTests(testCases);
// Assert
VerifyE2E.FailedTestCount(testResults, 0);
VerifyE2E.TestsPassed(
testResults,
"DynamicDataGenericCollectionsTests (System.Collections.Generic.List`1[System.Int32],System.Collections.Generic.List`1[System.String],System.Collections.Generic.List`1[System.Boolean])",
"DynamicDataGenericCollectionsTests (System.Collections.Generic.List`1[System.Int32],System.Collections.Generic.List`1[System.String],System.Collections.Generic.List`1[System.Boolean])",
"DynamicDataGenericCollectionsTests (System.Collections.Generic.List`1[System.Int32],System.Collections.Generic.List`1[System.String],System.Collections.Generic.List`1[System.Boolean])",
"DynamicDataGenericCollectionsTests (System.Collections.Generic.List`1[System.Int32],System.Collections.Generic.List`1[System.String],System.Collections.Generic.List`1[System.Boolean])");
// We cannot assert the expected ID as it is path dependent
testResults.Select(x => x.TestCase.Id.ToString()).Should().OnlyHaveUniqueItems();
}
public void TestIdUniqueness_TestDataSourceArrays_FullyQualifiedStrategy()
{
// Arrange
string assemblyPath = GetAssetFullPath(FullyQualifiedStrategyDll);
// Act
System.Collections.Immutable.ImmutableArray<Microsoft.VisualStudio.TestPlatform.ObjectModel.TestCase> testCases = DiscoverTests(assemblyPath, "FullyQualifiedName~TestDataSourceArraysTests");
System.Collections.Immutable.ImmutableArray<Microsoft.VisualStudio.TestPlatform.ObjectModel.TestResult> testResults = RunTests(testCases);
// Assert
VerifyE2E.FailedTestCount(testResults, 0);
VerifyE2E.TestsPassed(
testResults,
"Custom name",
"Custom name",
"Custom name");
// We cannot assert the expected ID as it is path dependent
testResults.Select(x => x.TestCase.Id.ToString()).Should().OnlyHaveUniqueItems();
}
public void TestIdUniqueness_TestDataSourceTuples_FullyQualifiedStrategy()
{
// Arrange
string assemblyPath = GetAssetFullPath(FullyQualifiedStrategyDll);
// Act
System.Collections.Immutable.ImmutableArray<Microsoft.VisualStudio.TestPlatform.ObjectModel.TestCase> testCases = DiscoverTests(assemblyPath, "FullyQualifiedName~TestDataSourceTuplesTests");
System.Collections.Immutable.ImmutableArray<Microsoft.VisualStudio.TestPlatform.ObjectModel.TestResult> testResults = RunTests(testCases);
// Assert
VerifyE2E.FailedTestCount(testResults, 0);
VerifyE2E.TestsPassed(
testResults,
"Custom name",
"Custom name");
// We cannot assert the expected ID as it is path dependent
testResults.Select(x => x.TestCase.Id.ToString()).Should().OnlyHaveUniqueItems();
}
public void TestIdUniqueness_TestDataSourceGenericCollections_FullyQualifiedStrategy()
{
// Arrange
string assemblyPath = GetAssetFullPath(FullyQualifiedStrategyDll);
// Act
System.Collections.Immutable.ImmutableArray<Microsoft.VisualStudio.TestPlatform.ObjectModel.TestCase> testCases = DiscoverTests(assemblyPath, "FullyQualifiedName~TestDataSourceGenericCollectionsTests");
System.Collections.Immutable.ImmutableArray<Microsoft.VisualStudio.TestPlatform.ObjectModel.TestResult> testResults = RunTests(testCases);
// Assert
VerifyE2E.FailedTestCount(testResults, 0);
VerifyE2E.TestsPassed(
testResults,
"Custom name",
"Custom name",
"Custom name",
"Custom name");
// We cannot assert the expected ID as it is path dependent
testResults.Select(x => x.TestCase.Id.ToString()).Should().OnlyHaveUniqueItems();
}
}