I created a portable class library and then targeted it at .NETStandard 1.5 from the project properties. I then created a second project with the exact same project settings, but added code to use for invoking and testing the code in the first project. But I have been unable to add MSTest to use for triggering execution. I tried using the guidance at stack overflow # 41350323 https://stackoverflow.com/questions/41350323/unit-testing-a-net-standard-1-6-library
but ran into problems. Wondering if anyone out there has been able to use MSTest for unit testing portable .NETStandard class libraries. Note that I also tried using the guidance for .NET core https://blogs.msdn.microsoft.com/visualstudioalm/2016/05/30/announcing-mstest-framework-support-for-net-core-rc2-asp-net-core-rc2/ but the MSTest framework nuget does not seem to support .NETStandard.
如果不是单元测试,那么有没有办法从控制台调用?我只需要测试我的代码,这应该不会那么困难。
您可以在 .NET Standard 项目中定义逻辑(不过不要使用 PCL,请使用 VS2017 RC 中的 .NET Standard 类库模板),但单元测试项目应该有其目标平台(UWP/Desktop/Xamarin 或其他) )而不是 .NET 标准。例如,在 VS2017 RC 中,典型的单元测试项目可以是 .NET Core 控制台应用程序。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)