コード例 #1
0
 public void Setup()
 {
     bundle = new BundleImpl();
     writer = new Mock<IResponseWriter>();
     cache = new Mock<IBundleCache<BundleImpl>>();
     encoder = new Mock<IEncoder>();
     handler = new AssetHttpHandler<BundleImpl>(cache.Object);
 }
コード例 #2
0
        public void Should_Get_Bundle()
        {
            var bundle = new BundleImpl();

            provider.Setup(p => p.Get("test-BundleImpl-Bundle")).Returns((object)bundle);

            Assert.AreEqual(bundle, cache.Get("test"));
        }
コード例 #3
0
 public void Setup()
 {
     settings = new SettingsContext(false, ".min");
     bundle = new BundleImpl();
     bundle.Extension = "css";
     bundle.Hash = new byte[1];
     generator = new BasicUrlGenerator<BundleImpl>(settings);
 }
コード例 #4
0
        public void Should_Mark_Bundle_Rendered()
        {
            var bundle = new BundleImpl();
            bundle.Name = "test";

            state.MarkRendered(bundle);

            Assert.IsTrue(state.IsRendered(bundle));
        }
コード例 #5
0
        public void Should_Add_Bundle()
        {
            var bundle = new BundleImpl();
            bundle.Name = "test";

            cache.Add(bundle);

            provider.Verify(p => p.Insert("test-BundleImpl-Bundle", bundle), Times.Once());
        }
コード例 #6
0
        public void Should_Render_Bundle()
        {
            var bundle = new BundleImpl();
            bundle.Name = "test";
            var state = new BundlerState();

            renderer.Render(bundle, state);

            tagWriter.Verify(t => t.Write(It.IsAny<TextWriter>(), bundle));
            Assert.True(state.IsRendered(bundle));
        }
コード例 #7
0
        public void Should_Generate_Url()
        {
            var bundle = new BundleImpl();
            var url = "/wab.axd/css/asd/file-css";

            urlGenerator.Setup(g => g.Generate(bundle)).Returns(url);

            processor.Process(bundle);

            Assert.AreEqual(url, bundle.Url);
            urlGenerator.Verify(g => g.Generate(bundle));
        }
コード例 #8
0
        public void Should_Render_All_Bundles()
        {
            var bundle = new BundleImpl();
            bundle.Name = "test";

            var bundleTwo = new BundleImpl();
            bundleTwo.Name = "testTwo";

            var state = new BundlerState();
            var bundles = new List<BundleImpl>()
            {
                bundle,
                bundleTwo
            };

            renderer.RenderAll(bundles, state);

            tagWriter.Verify(t => t.Write(It.IsAny<TextWriter>(), bundle));
            tagWriter.Verify(t => t.Write(It.IsAny<TextWriter>(), bundleTwo));
            Assert.True(state.IsRendered(bundle));
            Assert.True(state.IsRendered(bundleTwo));
        }
コード例 #9
0
 public void Setup()
 {
     processor = new MergeProcessor<BundleImpl>();
     bundle = new BundleImpl();
 }