Hi.
NCrunch does not seem to care if an attribute is used on interface method, but only when used on the test method itself. Is this by design?
Scenario: I have 2 test projects, 1 for external system HTTP tests and 1 for local HTTP tests. In order to avoid duplicating the tests I have an interface which declares the tests. I would like NCrunch attributes to work on interface level.
In code below, I need to duplicate both [Test] and [ExlusivelyUses] on implementations in order for NCrunch to pick up methods as tests, as well as reading the attributes.
(It would be nice for NCrunch to see if one test methods are interface implementations and if so pick up any attributes defined in that one).
Example code:
Code:
public interface IBusinessTests {
[Test]
[ExclusivelyUses("WebResource")]
void TestSomething();
}
public class MyTestInvoker : IBusinessTests {
public MyTestInvoker(IApiClient client) {
_client = client;
}
public void TestSomething() {
_client.DoSomething();
}
}
//assembly1
public class DbTest { ... }
public class SystemTests : DbTest, IBusinessTests {
private IBusinessTests _invoker = new MyTestInvoker(new ApiClient("(- BROKEN LINK -)"))
[Test]
[ExclusivelyUses("WebResource")]
public void TestSomething() {
_invoker.TestSomething();
}
}
//assembly2
public class RemoteTest { ... }
public class LocalTests : RemoteTest, IBusinessTests {
private IBusinessTests _invoker = new MyTestInvoker(new ApiClient("(- BROKEN LINK -)"))
[Test]
[ExclusivelyUses("WebResource")]
public void TestSomething() {
_invoker.TestSomething();
}
}
Thanks.