本文整理汇总了C#中BundleResponse.ShouldNotBe方法的典型用法代码示例。如果您正苦于以下问题:C# BundleResponse.ShouldNotBe方法的具体用法?C# BundleResponse.ShouldNotBe怎么用?C# BundleResponse.ShouldNotBe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BundleResponse
的用法示例。
在下文中一共展示了BundleResponse.ShouldNotBe方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GivenAJavascriptFile_Process_ReturnsABundledResponse
public void GivenAJavascriptFile_Process_ReturnsABundledResponse()
{
// Arrange.
var compressorConfig = new JavaScriptCompressorConfig();
var transform = new YuiCompressorTransform(compressorConfig);
var contextBase = A.Fake<HttpContextBase>();
var bundles = new BundleCollection();
var javascriptContent = File.ReadAllText("Javascript Files\\jquery-1.10.2.js");
var memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(javascriptContent));
var fakeStream = A.Fake<Stream>(x => x.Wrapping(memoryStream));
var fakeVirtualFile = A.Fake<VirtualFile>(x => x.WithArgumentsForConstructor(new[] { "/Scripts/jquery-1.10.2.js" }));
fakeVirtualFile.CallsTo(x => x.Open()).Returns(fakeStream);
var bundleFiles = new List<BundleFile>
{
new BundleFile("/Scripts/jquery-1.10.2.js", fakeVirtualFile)
};
var bundleContext = new BundleContext(contextBase, bundles, "~/bundles/jquery");
var bundleResponse = new BundleResponse(null, bundleFiles);
// Act.
transform.Process(bundleContext, bundleResponse);
// Assert.
bundleResponse.ShouldNotBe(null);
bundleResponse.Content.Substring(0, 300).ShouldBe("/*\n * jQuery JavaScript Library v1.10.2\n * http://jquery.com/\n *\n * Includes Sizzle.js\n * http://sizzlejs.com/\n *\n * Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors\n * Released under the MIT license\n * http://jquery.org/license\n *\n * Date: 2013-07-03T13:48Z\n */\n(function(bW,bU){v");
bundleResponse.Content.Length.ShouldBe(105397);
memoryStream.Dispose();
}