单元测试自定义KnowledgeSyncProvider [英] Unit testing a custom KnowledgeSyncProvider

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

问题描述

问候,

我正处于基于KnowledgeSyncProvider的自定义同步提供程序的中间。我正在尝试完成单元测试。一个问题就是在目的地上测试ProcessChangeBatch。在该方法中,我使用NotifyingChangeApplier。当syncSessionContext参数为null时,NotifyingChangeApplier.ApplyChanges会抛出InvalidOperationException。我不能创建一个模拟SyncSessionContext实例,因为该类的构造函数标记为内部。

有关如何对这种方法进行单元测试的任何建议?

谢谢,-rory

解决方案

< blockquote>该方法现已公开(v 2.0 CTP2)。您可以使用.net反射方法来创建实例吗?


Greetings,

I'm in the middle of a custom sync provider based on KnowledgeSyncProvider. I'm attempting to finish the unit tests. One problem spot specifically is testing ProcessChangeBatch on the destination. In that method, I use NotifyingChangeApplier. NotifyingChangeApplier.ApplyChanges throws an InvalidOperationException when the syncSessionContext parameter is null. I cannot make a mock SyncSessionContext instance since that class's constructor is marked internal.

Any suggestions on how I could unit test this method?

Thanks,
-rory

解决方案

The method is now public (v 2.0 CTP2). You could use .net reflection methods to create an instance?


这篇关于单元测试自定义KnowledgeSyncProvider的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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