I am trying to use ValueSourceAttribute
for my tests.
Here is an example
[Test]
public async Task TestDocumentsDifferentFormats(
[ValueSource(nameof(Formats))] string format,
[ValueSource(nameof(Documents))] IDocument document)
{
The interesting thing is that Formats
list (first argument) works perfectly, however it cannot resolve second argument, even if it defined in the same way.
Here is how I defined Documents static list
public class DocumentFactory
{
public static readonly List<IDocument> Documents=
new List<IDocument>
{
// Init documents
};
}
But when I try to run my tests it throws an error.
The sourceName specified on a ValueSourceAttribute must refer to a non null static field, property or method.
What can cause this problem ? I would be grateful for any help.
Aucun commentaire:
Enregistrer un commentaire