Xamarin portable .NETStandard 1.5 unit test

爱⌒轻易说出口 提交于 2019-12-24 03:25:53

问题


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 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 but the MSTest framework nuget does not seem to support .NETStandard.

If not a unit test, then is there a way to invoke from a console? I just need to test my code and this should not be so difficult.


回答1:


You can define logic in a .NET Standard project (don't use PCL though, use the .NET Standard Class Library template in VS2017 RC), but then the unit test project should have its target platform (UWP/Desktop/Xamarin or others) instead of .NET Standard. For example, in VS2017 RC, a typical unit testing project can be a .NET Core console app.



来源:https://stackoverflow.com/questions/41486116/xamarin-portable-netstandard-1-5-unit-test

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!