Question

I have a couple of methods that check for assignablity or interface assignabilty between types. Therefore I have signatures like (Type type1, Type type2).

Pex struggles to generate inputs for these parameters and ends up with some type build something or other type (sorry closed VS already) because Type itself is abstract.

I tried creating a factory that would pick one of four test 'types' based on inputs and then hoped that Pex would work the factory out to generate different inputs, and therefore put different inputs into my test method.

  • typeof(object) and typeof(object)
  • typeof(object) and typeof(string)
  • and so on...

Now it just complains that Sytem.Type is abstract and can't be explored. I'm new to Pex, but I don't know how else to generate varying inputs for the methods.

Any help?

Was it helpful?

Solution

Use an int as input and use a switch to choose a type based on the int value. A nasty hack, but sometimes required with Pex.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top