Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        public void WhenFindAssetByPathNotFound_ThenNullReturned()
        {
            var bundle = new TestableBundle("~/test");

            bundle.FindAssetByPath("~/test/notfound.js").ShouldBeNull();
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
        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);
        }
Exemplo n.º 8
0
        public void WhenFindAssetByPathNotFound_ThenNullReturned()
        {
            var bundle = new TestableBundle("~/test");

            bundle.FindAssetByPath("~/test/notfound.js").ShouldBeNull();
        }