本文介绍了Mole Framework:静态只读属性为null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



为了删除外部依赖项以进行测试,我试图实现鼹鼠框架



一切正常直到我用静态只读属性来训练这个类。



创建该类的痣不是问题的根本原因但是只读属性正在创建问题



在我的实际方法中使用readonly属性,并且在创建mole实例之后该属性的值为null

因为没有setter,getter for这个属性所以鼹鼠类没有给这个属性覆盖



然而没有鼹鼠测试用例没有给出错误并从外部来源获取数据



请在这种情况下建议如何处理



提前致谢

Hi,
In order to remove external dependency for testing purpose i was trying to implement the mole framework

everything was working fine until i have moled the class with static readonly property.

Creating mole of that class is not the root cause of issue but that readonly property is creating the issue

in my actual method that readonly property is used and value of that property is coming null after creating mole instance
since there is not setter, getter for this property so mole class is not giving override for this property

However without mole testcase is not giving error and fetching the data from external sources

Please suggest how to proceed in this case

Thanks in advance

推荐答案




这篇关于Mole Framework:静态只读属性为null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 15:45