Skip to main content

Dotnet Test Enumerate

[CSharp]

Sample Code

using System;
using System.Collections.Generic;
using NUnit.Framework;

namespace Program
{
internal class Test
{
private static IEnumerable<TestCaseData> TestCaseData()
{
const string category = TestCategory.DEVMODE;

yield return new TestCaseData(ContentStyle.Classic, Region.US)
.SetDescription("xxx")
.SetProperty("TestId", "xxx")
.SetCategory(category);
}

[TestCaseSource(nameof(TestCaseData))]
public void TestRun(ContentStyle contentStyle, Region region)
{
Console.WriteLine("DoSomething");
}
}
}

internal static class TestCategory
{
public const string DEVMODE = "DEVMODE";
}

public enum Region
{
US,
UK,
ASIA,
NA
}

public enum ContentStyle
{
Classic,
Advance,
Special
}