Skip to content
This repository was archived by the owner on Dec 13, 2018. It is now read-only.

Commit 782cfd3

Browse files
committed
Skip member data by property
1 parent cc80f22 commit 782cfd3

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/Microsoft.Extensions.Logging.Testing/Xunit/LoggedConditionalTheoryDiscoverer.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,20 @@ protected override IEnumerable<IXunitTestCase> CreateTestCasesForDataRow(
3232
object[] dataRow)
3333
{
3434
var skipReason = testMethod.EvaluateSkipConditions();
35+
if (skipReason == null && dataRow?.Length > 0)
36+
{
37+
var obj = dataRow[0];
38+
if (obj != null)
39+
{
40+
var type = obj.GetType();
41+
var property = type.GetProperty("Skip");
42+
if (property != null && property.PropertyType.Equals(typeof(string)))
43+
{
44+
skipReason = property.GetValue(obj) as string;
45+
}
46+
}
47+
}
48+
3549
return skipReason != null
3650
? base.CreateTestCasesForSkippedDataRow(discoveryOptions, testMethod, theoryAttribute, dataRow, skipReason)
3751
: base.CreateTestCasesForDataRow(discoveryOptions, testMethod, theoryAttribute, dataRow);

0 commit comments

Comments
 (0)