Umbraco 单元测试失败 [英] Umbraco unit tests failing

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

问题描述

我正在尝试遵循 .

I am trying to follow Jorge Lusar's suggestion on unit testing Umbraco. I could not get GetRoutingContext method to work because the Umbraco.Web.Routing.UrlProvider constructor is getting a null reference exception (I had downloaded an umbraco 7.0.4 installation previously and compiled the Umbraco.Tests.dll).

As I was getting out of options, I decided to download a fresh copy of Umbraco, compile and run a test that would execute the UrlProvider constructor. To my surprise, I got the null reference exception in there too so apparently, this bug has nothing to do with my solution but Umbraco's instead.

The images speak for themselves. Can anyone plase help with this? Is this really a bug or there's something I can do here?

解决方案

The solution to the problem was to copy the config settings (the ones in the UnitTests project of the Umbraco solution) to my test project.

Umbraco is dependendant on config files. Not ideal for unit tests but it worked.

Here it is explained how to stub Umbraco dependencies.

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

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