1

バンドルに含まれるスクリプトをレンダリングするために作成されたカスタム ヘルパーの単体テストを実行しようとしています。

私の問題は、BundleTable.Bundlesオブジェクトのモックを作成する必要があることですが、これを実現する方法が見つかりませんでした。

私の方法は次のようになります。

public IEnumerable<string> GetBundleFilesCollection(string bundleUrl)
{
        bundleUrl = string.Concat("~", bundleUrl);
        var collection = new BundleCollection { BundleTable.Bundles.GetBundleFor(bundleUrl) };
        var bundleResolver = new BundleResolver(collection);
        IEnumerable<string> fileUrls = bundleResolver.GetBundleContents(bundleUrl);
        return fileUrls;
}

これを達成する方法はありますか?

Rhino Mocks を使用しています。

4

1 に答える 1