Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在.Net 4.6和Windows Universal 10.0之间测试可移植库_C#_Unit Testing_Portable Class Library - Fatal编程技术网

C# 在.Net 4.6和Windows Universal 10.0之间测试可移植库

C# 在.Net 4.6和Windows Universal 10.0之间测试可移植库,c#,unit-testing,portable-class-library,C#,Unit Testing,Portable Class Library,我编写了一个可移植类库,目标是.netframework4.6和windowsuniversal10.0,它使用了一些系统反射方法: Type.GetProperty PropertyInfo.GetValue 为了测试我的方法,我编写了一个针对.netframework4.6的测试库。所有不使用System.Reflection的方法已正确测试。如果从测试库调用使用上述方法之一的方法,则会出现以下错误: 我怎样才能解决它?我做错了什么?我想你别忘了在测试项目的引用中添加“Sustem.R

我编写了一个可移植类库,目标是
.netframework4.6
windowsuniversal10.0
,它使用了一些
系统反射方法:

  • Type.GetProperty
  • PropertyInfo.GetValue
为了测试我的方法,我编写了一个针对
.netframework4.6
的测试库。所有不使用
System.Reflection的方法已正确测试。如果从测试库调用使用上述方法之一的方法,则会出现以下错误:


我怎样才能解决它?我做错了什么?

我想你别忘了在测试项目的引用中添加“Sustem.Reflection.TypeExtensions”…我没有添加它,但为什么它仍在生成?你的便携库项目和测试项目在同一个解决方案中吗?如果你有FileNotFoundException,这是因为您试图在某处打开文件或加载程序集。因此,您应该尝试查找引发此异常的原因。