English 中文(简体)
MVC3
原标题:Testing Custom Razor Helpers in MVC3
问题回答

现在我的问题是,我如何检验这件事?

它很容易孤立地对拉汉多语助手进行检测。

为了能够进行单位测试和观察(并不取决于你使用的具体观察引擎),你应当使用标准的超文本助手,作为向<代码>HtmlHelper或UrlHelper级推广的一种方法。 例:

public static class UrlExtensions
{
    public static string ThemeHelper(this UrlHelper urlHelper, string fileName)
    {
        return urlHelper.Content("~/Content/Themes/" + Theme.CurrentTheme.FolderName + "/" + fileName);
    }
}




相关问题
Cucumber Cleanup

SO Folk, Anyone around these parts know if you can keep Cucumber from cleansing test data at the end of a run? I ve a few tests that continue to fail and I d like to have a look at the data backing ...

Integration Testing for a Web App

I want to do full integration testing for a web application. I want to test many things like AJAX, positioning and presence of certain phrases and HTML elements using several browsers. I m seeking a ...

Unit Testing CodeIgniter with Simpletest - very few tests

On our development team, we decided to give Unit Testing a try. We use Simpletest. However, it s been a tough road. After a week, I only have created 1 unit test that tests a certain helper file. That ...

热门标签