public void GivenAssetInSubDirectory_WhenFindAssetByPath_ThenAssetWithMatchingFilenameIsReturned() { var bundle = new TestableBundle("~/test"); var asset = new StubAsset("~/test/sub/asset.js"); bundle.Assets.Add(asset); bundle.FindAssetByPath("~/test/sub/asset.js").ShouldBeSameAs(asset); }
public void FindAssetByPathReturnsAssetWithMatchingFilename() { var bundle = new TestableBundle("~/test"); var asset = new StubAsset("~/test/asset.js"); bundle.Assets.Add(asset); bundle.FindAssetByPath("~/test/asset.js").ShouldBeSameAs(asset); }
public void GivenConcatenatedAsset_WhenFindAssetByPath_ThenSourceAssetsAreSearched() { var bundle = new TestableBundle("~/test"); var asset1 = new StubAsset("~/test/asset1.js"); var asset2 = new StubAsset("~/test/asset2.js"); // Simulate concatenated asset. We only need the Accept method to visit each child. var concatenatedAsset = new Mock <IAsset>(); concatenatedAsset.Setup(a => a.Accept(It.IsAny <IBundleVisitor>())) .Callback <IBundleVisitor>(v => { v.Visit(asset1); v.Visit(asset2); }); bundle.Assets.Add(concatenatedAsset.Object); bundle.FindAssetByPath("~/test/asset2.js").ShouldBeSameAs(asset2); }
public void WhenFindAssetByPathNotFound_ThenNullReturned() { var bundle = new TestableBundle("~/test"); bundle.FindAssetByPath("~/test/notfound.js").ShouldBeNull(); }
public void GivenConcatenatedAsset_WhenFindAssetByPath_ThenSourceAssetsAreSearched() { var bundle = new TestableBundle("~/test"); var asset1 = StubAsset("~/test/asset1.js"); var asset2 = StubAsset("~/test/asset2.js"); // Simulate concatenated asset. We only need the Accept method to visit each child. var concatenatedAsset = new Mock<IAsset>(); concatenatedAsset.Setup(a => a.Accept(It.IsAny<IBundleVisitor>())) .Callback<IBundleVisitor>(v => { v.Visit(asset1); v.Visit(asset2); }); bundle.Assets.Add(concatenatedAsset.Object); bundle.FindAssetByPath("~/test/asset2.js").ShouldBeSameAs(asset2); }
public void GivenAssetInSubDirectory_WhenFindAssetByPath_ThenAssetWithMatchingFilenameIsReturned() { var bundle = new TestableBundle("~/test"); var asset = StubAsset("~/test/sub/asset.js"); bundle.Assets.Add(asset); bundle.FindAssetByPath("~/test/sub/asset.js").ShouldBeSameAs(asset); }
public void FindAssetByPathReturnsAssetWithMatchingFilename() { var bundle = new TestableBundle("~/test"); var asset = StubAsset("~/test/asset.js"); bundle.Assets.Add(asset); bundle.FindAssetByPath("~/test/asset.js").ShouldBeSameAs(asset); }
public void WhenFindAssetByPathNotFound_ThenNullReturned() { var bundle = new TestableBundle("~/test"); bundle.FindAssetByPath("~/test/notfound.js").ShouldBeNull(); }