Skip to content

Instantly share code, notes, and snippets.

@jonesandy
Last active January 29, 2021 13:59
Show Gist options
  • Save jonesandy/070cab55861622d3156a08f4e957899f to your computer and use it in GitHub Desktop.
Save jonesandy/070cab55861622d3156a08f4e957899f to your computer and use it in GitHub Desktop.
using Xunit.Sdk;
public class MyTestDataAttribute : DataAttribute
{
// Auto-implemented member
public override IEnumerable<object[]> GetData(MethodInfo testMethod)
{
// Create returned object arrays
yield return new object[]{ someData, someData, someData };
yield return new object[]{ someData, someData, someData };
}
}
public class TestClass
{
[Theory]
[MyTestDataAttribute]
public void Test(param one, param two, param three)
{
// Test things
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment