How to provide List as a data source for a data theory, I can't find anything in InlineData that supports this :
[InlineData(null, new[] { 42, 2112 }, null)] // This doesn't work, I need something that works with List<int>
[Trait("Category", "API")]
[Trait("Category", "Partner")]
[Trait("Category", "Smoke")]
public void VerifyGetCarListAsync(int? colorID, List<int> carIDs, int? sellerID){//}
This cannot be accomplished with InlineData
you can only do this with MemberData
, PropertyData
or ClassData
see the MemberData
example below.
[MemberData(nameof(Data))]
public void VerifyGetCarListAsync(int? colorID, List<int> carIDs, int? sellerID){
// test code
}
public static IEnumerable<object[]> Data(){
yield return new object[] { null, new List<int>{ 42, 2112 }, null };
yield return new object[] { 1, new List<int>{ 43, 2112 }, null };
yield return new object[] { null, new List<int>{ 44, 2112 }, 6 };
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With