Ejemplo n.º 1
0
        public void Generates_Two_CssFiles_FromScss()
        {
            ResetOutputFolder();

            var task = new ScssProcessorTask
            {
                OutputDirectory = OutputFolder,
                ScssFiles       = Directory.GetFiles(Scss, "*"),
                Logger          = new XunitLog(_testOutputHelper)
            };

            bool success   = false;
            var  exception = Record.Exception(() =>
            {
                success = task.Execute();
            });

            Assert.Null(exception);
            Assert.True(success);

            _testOutputHelper.WriteLine($"Generated Files: {task.GeneratedCssFiles.Length}");
            Assert.Equal(2, task.GeneratedCssFiles.Length);
            var files = Directory.GetFiles(OutputFolder, "*", SearchOption.AllDirectories);

            _testOutputHelper.WriteLine($"Files found: {string.Join(", ", files)}");
            Assert.Equal(2, files.Length);

            foreach (var item in task.GeneratedCssFiles)
            {
                Assert.Contains(item.ItemSpec.ToString(), files);
            }
        }
Ejemplo n.º 2
0
        public void GeneratedExpectedCss_FromScss(string fileName, string expectedFileName)
        {
            _testOutputHelper.WriteLine($"Checking: {fileName} - {expectedFileName}");
            var task = new ScssProcessorTask
            {
                OutputDirectory = OutputFolder,
                ScssFiles       = Directory.GetFiles(Scss, "*"),
                Logger          = new XunitLog(_testOutputHelper)
            };

            bool success   = false;
            var  exception = Record.Exception(() =>
            {
                success = task.Execute();
            });

            Assert.Null(exception);
            Assert.True(success);

            Assert.Equal(2, task.GeneratedCssFiles.Length);

            var files = Directory.GetFiles(OutputFolder, fileName, SearchOption.AllDirectories);

            Assert.Single(files);
            var generatedFile = files.First(f => f.EndsWith(fileName, StringComparison.CurrentCultureIgnoreCase));

            Assert.Equal(File.ReadLines(Path.Combine(ExpectedCssPath, expectedFileName)).First(),
                         File.ReadLines(generatedFile).First());
        }
Ejemplo n.º 3
0
        public void GeneratedExpectedCss_FromScss(string fileName, string expectedFileName)
        {
            _testOutputHelper.WriteLine($"Checking: {fileName} - {expectedFileName}");
            var task = new ScssProcessorTask
            {
                MinimizeCSS     = $"{expectedFileName.EndsWith(".min.css", StringComparison.InvariantCultureIgnoreCase)}",
                OutputInProject = bool.FalseString,
                OutputDirectory = OutputFolder,
                NoneIncluded    = Directory.GetFiles(Scss, "*"),
                Logger          = new XunitLog(_testOutputHelper)
            };

            _testOutputHelper.WriteLine($"Minimize CSS: {task.MinimizeCSS}");

            bool success   = false;
            var  exception = Record.Exception(() =>
            {
                success = task.Execute();
            });

            Assert.Null(exception);
            Assert.True(success);

            Assert.Equal(2, task.GeneratedCssFiles.Length);

            var files = Directory.GetFiles(OutputFolder, fileName, SearchOption.AllDirectories);

            Assert.Single(files);
            var generatedFile = files.First(f => f.EndsWith(fileName, StringComparison.CurrentCultureIgnoreCase));

            Assert.Equal(File.ReadAllText(Path.Combine(ExpectedCssPath, expectedFileName)),
                         File.ReadAllText(generatedFile));
        }
Ejemplo n.º 4
0
        public void NoOutputDoesNotCauseNullOutputCollection()
        {
            var task = new ScssProcessorTask
            {
                OutputDirectory = OutputFolder,
                ScssFiles       = Directory.GetFiles(ExpectedCssPath, "*"),
                Logger          = new XunitLog(_testOutputHelper)
            };

            bool success   = false;
            var  exception = Record.Exception(() =>
            {
                success = task.Execute();
            });

            Assert.Null(exception);
            Assert.True(success);
            Assert.NotNull(task.GeneratedCssFiles);
            Assert.Empty(task.GeneratedCssFiles);
        }