Is there any way to pass generic types using a TestCase to a test in NUnit?
This is what I would like to do but the syntax is not correct...
<
Start with the test first--even when testing. What do you want to do? Probably something like this:
[Test]
public void Test_GenericCalls()
{
MyMethod_GenericCall_MakesGenericCall("an int response");
MyMethod_GenericCall_MakesGenericCall("a string response");
:
}
Then you can just make your test a plain old function test. No [Test] marker.
public void MyMethod_GenericCall_MakesGenericCall(string expectedResponse)
{
// Arrange
// Act
var response = MyClassUnderTest.MyMethod();
// Assert
Assert.AreEqual(expectedResponse, response);
}