public void Should_Execute_Runner_And_Add_Modifier() { var asset = new AssetBaseImpl(); asset.StreamContent = "url(../image/file.css);"; asset.Source = "/Source/file.css"; var bundle = new StyleSheetBundle(); bundle.Assets.Add(asset); var context = processor.CreateRunnerContext("../image/file.css", asset); var result = new Mock<ImagePipelineRunnerResult>(); result.Object.Changed = true; result.Object.OldPath = "../image/file.css"; result.Object.NewPath = "/image/file.css"; Func<ImagePipelineRunnerContext, bool> isContextEqual = (c) => { var isEqual = c.ImagePath == context.ImagePath && c.SourcePath == context.SourcePath && c.AppRootDirectory == directory.Object; return isEqual; }; runner.Setup(r => r.Execute(It.Is<ImagePipelineRunnerContext>(c => isContextEqual(c)))) .Returns(result.Object); processor.Process(bundle); var content = asset.OpenStream().ReadToEnd(); //execute modifier so we can test for results runner.Verify(r => r.Execute(It.Is<ImagePipelineRunnerContext>(c => isContextEqual(c)))); Assert.AreEqual("url(/image/file.css);", content); }
public void Should_Create_Name() { var asset = new AssetBaseImpl(); asset.Source = "~/test/image.png"; var name = ImageHelper.CreateBundleName(asset); Assert.AreEqual("0cda79a4083842efcc13b2042d35eadb-image-png", name); }
public void Setup() { settings = new SettingsContext(); asset = new AssetBaseImpl(); bundle = new StyleSheetBundle(); bundle.Assets.Add(asset); processor = new ExpandPathProcessor(settings); }
public void Should_Minify() { var asset = new AssetBaseImpl("test"); minifier.Setup(m => m.Minify("test")).Returns("test"); var returnStream = modifier.Modify(asset.OpenStream()); minifier.Verify(m => m.Minify("test")); Assert.AreEqual("test", returnStream.ReadToEnd()); }