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);
 }
        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"));
        }
 public void Setup()
 {
     settings = new SettingsContext(false, ".min");
     bundle = new BundleImpl();
     bundle.Extension = "css";
     bundle.Hash = new byte[1];
     generator = new BasicUrlGenerator<BundleImpl>(settings);
 }
        public void Should_Mark_Bundle_Rendered()
        {
            var bundle = new BundleImpl();
            bundle.Name = "test";

            state.MarkRendered(bundle);

            Assert.IsTrue(state.IsRendered(bundle));
        }
        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());
        }
        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));
        }
        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));
        }
        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));
        }
 public void Setup()
 {
     processor = new MergeProcessor<BundleImpl>();
     bundle = new BundleImpl();
 }