Esempio n. 1
0
        public GivenConfigurationClassInAssembly_WhenExecute()
        {
            originalDirectory = Environment.CurrentDirectory;
            path = new TempDirectory();

            var assemblyPath = Path.Combine(path, "Test.dll");

            BundleConfiguration.GenerateAssembly(assemblyPath);

            File.WriteAllText(Path.Combine(path, "test.css"), "p { background-image: url(test.png); }");
            File.WriteAllText(Path.Combine(path, "test.coffee"), "x = 1\nlog(x)");
            File.WriteAllText(Path.Combine(path, "test.png"), "");

            Environment.CurrentDirectory = path;
            cachePath = Path.Combine(path, "cache");

            var buildEngine = new BuildEngineStub();

            var task = new CreateBundles
            {
                Source      = path,
                Bin         = path,
                Output      = cachePath,
                BuildEngine = buildEngine
            };

            try
            {
                task.Execute();
            }
            catch (Exception exception)
            {
                var t = exception.ToString();
            }
        }
Esempio n. 2
0
        public GivenConfigurationClassInAssembly_WhenExecute()
        {
            originalDirectory = Environment.CurrentDirectory;
            path = new TempDirectory();

            var assemblyPath = Path.Combine(path, "Test.dll");

            BundleConfiguration.GenerateAssembly(assemblyPath);

            File.WriteAllText(Path.Combine(path, "test.css"), "p { background-image: url(test.png); }");
            File.WriteAllText(Path.Combine(path, "test.coffee"), "x = 1");
            File.WriteAllText(Path.Combine(path, "test.png"), "");

            Environment.CurrentDirectory = path;
            cachePath = Path.Combine(path, "cache");

            var task = new CreateBundles
            {
                Source      = path,
                Bin         = path,
                Output      = cachePath,
                BuildEngine = Mock.Of <IBuildEngine>()
            };

            task.Execute();
        }
        public CreateBundlesWithRawFilesTests()
        {
            root = new TempDirectory();

            CreateDirectory("source");
            CreateDirectory("source\\bin");
            CreateDirectory("output");

            WriteFile("source\\test.css", @"p { background: url(test.png); } .other { background: url(notfound.png); }");
            WriteFile("source\\test.png", "image");

            var configurationDll = CompileConfigurationDll();

            File.Move(configurationDll, PathUtilities.Combine(root, "source", "bin", "test.dll"));
            File.Copy("Cassette.dll", PathUtilities.Combine(root, "source", "bin", "Cassette.dll"));
            File.Copy("Cassette.pdb", PathUtilities.Combine(root, "source", "bin", "Cassette.pdb"));
            File.Copy("AjaxMin.dll", PathUtilities.Combine(root, "source", "bin", "AjaxMin.dll"));
#if NET35
            File.Copy("Iesi.Collections.dll", PathUtilities.Combine(root, "source", "bin", "Iesi.Collections.dll"));
#endif
            buildEngine = new BuildEngineStub();
            var task = new CreateBundles
            {
                BuildEngine = buildEngine
            };

            var taskLoggingHelper = new TaskLoggingHelper(task);

            var command = new CreateBundlesCommand(
                PathUtilities.Combine(root, "source"),
                PathUtilities.Combine(root, "source", "bin"),
                PathUtilities.Combine(root, "output"),
                "/",
                true,
                taskLoggingHelper
                );

            CreateBundlesCommand.ExecuteInSeparateAppDomain(command);
        }
        public CreateBundlesWithRawFilesTests()
        {
            root = new TempDirectory();

            CreateDirectory("source");
            CreateDirectory("source\\bin");
            CreateDirectory("output");

            WriteFile("source\\test.css", @"p { background: url(test.png); } .other { background: url(notfound.png); }");
            WriteFile("source\\test.png", "image");

            var configurationDll = CompileConfigurationDll();

            File.Move(configurationDll, PathUtilities.Combine(root, "source", "bin", "test.dll"));
            File.Copy("Cassette.dll", PathUtilities.Combine(root, "source", "bin", "Cassette.dll"));
            File.Copy("Cassette.pdb", PathUtilities.Combine(root, "source", "bin", "Cassette.pdb"));
            File.Copy("AjaxMin.dll", PathUtilities.Combine(root, "source", "bin", "AjaxMin.dll"));
#if NET35
            File.Copy("Iesi.Collections.dll", PathUtilities.Combine(root, "source", "bin", "Iesi.Collections.dll"));
#endif
            buildEngine = new BuildEngineStub();
            var task = new CreateBundles
            {
                BuildEngine = buildEngine
            };

            var taskLoggingHelper = new TaskLoggingHelper(task);

            var command = new CreateBundlesCommand(
                PathUtilities.Combine(root, "source"),
                PathUtilities.Combine(root, "source", "bin"),
                PathUtilities.Combine(root, "output"),
                "/",
                true,
                taskLoggingHelper
            );

            CreateBundlesCommand.ExecuteInSeparateAppDomain(command);
        }