Another discovery while reading through the NuGet Gallery source. As I was taking a look at their tests I bumped into RequireRemoteHttpsAttributeFacts.cs and saw this attribute:
[Theory]
[InlineData(new object[] { "POST" })]
[InlineData(new object[] { "DELETE" })]
[InlineData(new object[] { "PUT" })]
[InlineData(new object[] { "head" })]
[InlineData(new object[] { "trace" })]
public void RequireHttpsAttributeReturns403IfNonGetRequest(string method)
{
...
}
Now, I realise this may be old news since XUnit Extensions has been around since at least 2008, but it was new to me. This works very similar to NUnit Testcase attribute, each of the InlineData will be passed to the test as an argument.
There are different data providers including in the xunit.extensions assembly:
1. ExcelData
2. InlineData
3. OleDbData
4. PropertyData
5. SqlServerData
An introduction blog post about xunit extensions can be found here (by Ben Hall).
0 comments:
Post a Comment