0

I am looking for a way to pass keyValuePair into my test with TestCase

[TestCase<KeyValuePair<int,string>>(1,"XX")]
public void someTest(KeyValuePair<int,string> expectedkeyValuePairs)
{
    // do some thing;
}

The answer is

[TestCase(1,"XXX")]
public void someTest(int key,string value)
{
    var expectedkeyValuePairs = new KeyValuePair<int, string>(key, value);
    // do some thing;
}
Chris Missal
  • 5,987
  • 3
  • 28
  • 46
wikinevis
  • 189
  • 1
  • 2
  • 11

1 Answers1

2

Simply use two separate parameters: One for key, one for value. And then create the KeyValuePair from them within your test.

Golo Roden
  • 140,679
  • 96
  • 298
  • 425