我有几个方法检查类型之间的可分配性或接口可分配性。 因此我有类似(Type type1, Type type2)签名。
Pex努力为这些参数生成输入,并以某种类型构建某种类型或其他类型(已关闭VS),因为Type本身是抽象的。
我试着创建一个工厂,根据输入选择四种测试“类型”中的一种,然后希望Pex能够将工厂用于生成不同的输入,并因此将不同的输入输入到我的测试方法中。
typeof(object)和typeof(object) typeof(object)和typeof(string) 等等...现在它只是抱怨Sytem.Type是抽象的,无法探索。 我是Pex的新手,但我不知道如何为方法生成不同的输入。
任何帮助?
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?
最满意答案
使用int作为输入并使用开关根据int值选择一个类型。 讨厌的黑客攻击,但有时需要佩克斯。
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.
更多推荐
发布评论