Does someone if the following code (idea, actually) is possible using xunit:
public class RepositoryTester {
private IRepository repository;
public RepositoryTester(IRepository repository) {
this.repository = repository;
)
[Fact] // Analogue of [Test] in other test packages.
void CanDoWhatever() {
// Test code
}
}
Now, if I attempt to run all unit test, it would fail as long as xunit attempts to create the object RepositoryTester by calling new RepositoryTester() (it invokes the constructor without parameters).
What I want to do can be equivalently expressed this way:
var tester1 = new RepositoryTester(new SQLRepository(...));
var tester2 = new RepositoryTester(new InMemoryRepository(...));
tester1. RUN_ALL_TESTS();
tester2. RUN_ALL_TESTS();
Does someone know if the following behavior is possible? (I really wish to use the same test package for every testable repository through it's interface).
Thank you