我一直试图摆脱iOS / Android测试工具并使我的VM单元测试直接在XS / VS测试运行器上运行,因为: 1)WAAAAY比每次加载线束更快 2)使在VSTS上运行更容易
我知道我不能直接从PCL运行它,因为" Bait&切换",所以在阅读@kentcb帖子http://kent-boogaart.com/blog/using-the-visual-studio-test-runner-for-mobile-development之后,我决定尝试在net45测试项目上运行它,看看它是怎么回事,但到目前为止仍然没有成功,我得到了一些错误,如:
System.TypeInitializationException:类型初始值设定项 ' ReactiveUI.ReactiveNotifyPropertyChangedMixin'抛出异常。
----> System.TypeInitializationException:' ReactiveUI.RxApp'的类型初始值设定项。抛出一个例外。 ----> System.TypeInitializationException:类型初始值设定项 ' ReactiveUI.CreatesCommandBindingViaEvent'抛出异常。at ReactiveUI.WhenAnyMixin.WhenAny [TSender,TRet,T1,T2](TSender 这,System.Linq.Expressions.Expression
1[TDelegate] property1, System.Linq.Expressions.Expression
1 [TDelegate] property2, System.Func`3 [T1,T2,TResult]选择器)[0x00000] in < 4aefaa9175534ecd872465be2cbe3a19>:0 at RxUIVIewModelUnitTesting.ViewModels.LoginViewModel..ctor (RxUIVIewModelUnitTesting.Services.IAuthenticationSystem authenticationSystem,System.Reactive.Concurrency.IScheduler 调度程序)[0x000b1] in /Users/giusepecasagrande/Git/Giusepe/RxUIVIewModelUnitTesting/src/RxUIVIewModelUnitTesting.ViewModels/LoginViewModel.cs:58 在 RxUIVIewModelUnitTesting.ViewModels.UnitTests.LoginViewModelTest.Setup ()[0x00020] in /Users/giusepecasagrande/Git/Giusepe/RxUIVIewModelUnitTesting/src/RxUIVIewModelUnitTesting.ViewModels.UnitTests/LoginViewModelTest.cs:28 at(包装器托管到原生) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object [],System.Exception&)at System.Reflection.MonoMethod.Invoke(System.Object obj, System.Reflection.BindingFlags invokeAttr,System.Reflection.Binder binder,System.Object []参数,System.Globalization.CultureInfo 文化)[0x00038] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/corlib/System.Reflection/MonoMethod的.cs:305- ReactiveUI.ReactiveNotifyPropertyChangedMixin..cctor()[0x00020]中的TypeInitializationException < 4aefaa9175534ecd872465be2cbe3a19>:0 --ReactiveUI.Registrations +<> c.b__0_7()[0x00000]中的TypeInitializationException < 4aefaa9175534ecd872465be2cbe3a19>:0 at ReactiveUI.DependencyResolverMixins + LT;> c__DisplayClass0_0.b__0 (System.Func
1[TResult] f, System.Type t) [0x00000] in <4aefaa9175534ecd872465be2cbe3a19>:0 at ReactiveUI.Registrations.Register (System.Action
2 [T1,T2] registerFunction)[0x00149]在&lt; 4aefaa9175534ecd872465be2cbe3a19&gt;中:0
在ReactiveUI.DependencyResolverMixins.InitializeReactiveUI (Splat.IMutableDependencyResolver解析器)[0x00028] in &lt; 4aefaa9175534ecd872465be2cbe3a19&gt;:0 at ReactiveUI.RxApp +&lt;&gt; c。&lt; .cctor&gt; b__0_0()[0x0000d] in &lt; 4aefaa9175534ecd872465be2cbe3a19&gt;:0 at Splat.Locator.RegisterResolverCallbackChanged(System.Action回调) [0x00039]在&lt; 66ec575cc13f4eaea0cbad3add11aa6e&gt;中:0 at ReactiveUI.RxApp..cctor()[0x00010] in &LT; 4aefaa9175534ecd872465be2cbe3a19&GT;:0
所以我提出了一个样本项目(https://github.com/GiusepeCasagrande/RxUIVIewModelUnitTesting),这里的任何帮助都会受到赞赏,即使它已经过了#34;没有办法可以解决问题&#34 ;,因为那时我只是回到测试线束并开始使用Cake for VSTS。
编辑:我忘了说:我在带有XS的Mac上运行它。所以我让一位朋友在Windows / VS上测试相同的解决方案,它的确有效!现在看来我在这里找到了一些Mac / mono限制。