Xamarin便携式.NETStandard 1.5单元测试 [英] Xamarin portable .NETStandard 1.5 unit test

查看:93
本文介绍了Xamarin便携式.NETStandard 1.5单元测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个可移植的类库,然后从项目属性.然后,我创建了具有完全相同的项目设置的第二个项目,但是添加了用于在第一个项目中调用和测试代码的代码.但是我一直无法添加MSTest用于触发执行.我尝试使用堆栈溢出#41350323 中的指南 但遇到了问题.想知道是否有人能够使用MSTest对便携式.NETStandard类库进行单元测试.请注意,我还尝试使用

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.

推荐答案

您可以在.NET Standard项目中定义逻辑(尽管不要使用PCL,请在VS2017 RC中使用.NET Standard Class Library模板),然后单元测试项目应具有其目标平台(UWP/Desktop/Xamarin或其他),而不是.NET Standard.例如,在VS2017 RC中,典型的单元测试项目可以是.NET Core控制台应用程序.

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.

这篇关于Xamarin便携式.NETStandard 1.5单元测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆