Ejemplo n.º 1
0
        public string ParseStatement(FileSetStatement data)
        {
            var dataToReturn = "";
            if (data.Type == "include")
                dataToReturn = ".Include(";
            else
                dataToReturn = ".Exclude(";

            var parts = data.Name.Split('/');
            for (int index = 0; index < parts.Length; index++)
            {
                if (index==0)
                {
                    dataToReturn += parts[index] + ")";
                    continue;
                }

                if (parts[index] == "**")
                {
                    dataToReturn += ".RecurseAllSubDirectories";
                    continue;
                }

                if (index==parts.Length-1)
                {
                    dataToReturn += ".Filter(\"" + parts[index] + "\")";
                    continue;
                }

                dataToReturn += ".Subfolder(" + parts[index] + ")";

            }

            return dataToReturn;
        }
 public void ShouldParseOneLine()
 {
     var data = new FileSetStatement();
     data.Type = "include";
     data.Name = "${dir.commons}/**/*.cs";
     var subject = new CompileSourcesParser();
     Assert.That(subject.ParseStatement(data), Is.EqualTo(".Include(${dir.commons}).RecurseAllSubDirectories.Filter(\"*.cs\")"));
     //var x =new FileSet().Include("").RecurseAllSubDirectories.Exclude()
 }
 public void Parse(XElement data, BuildProject buildProject)
 {
     foreach (var element in data.Elements())
     {
         var fileSetStatement = new FileSetStatement();
         fileSetStatement.Type = element.Name.ToString();
         fileSetStatement.Name = element.Attribute("name").Value;
         Statements.Add(fileSetStatement);
     }
 }
Ejemplo n.º 4
0
 public void Parse(XElement data, BuildProject buildProject)
 {
     foreach (var element in data.Elements())
     {
         var fileSetStatement = new FileSetStatement();
         fileSetStatement.Type = element.Name.ToString();
         fileSetStatement.Name = element.Attribute("name").Value;
         Statements.Add(fileSetStatement);
     }
 }
        public void ShouldParseOneLine()
        {
            var data = new FileSetStatement();

            data.Type = "include";
            data.Name = "${dir.commons}/**/*.cs";
            var subject = new CompileSourcesParser();

            Assert.That(subject.ParseStatement(data), Is.EqualTo(".Include(${dir.commons}).RecurseAllSubDirectories.Filter(\"*.cs\")"));
            //var x =new FileSet().Include("").RecurseAllSubDirectories.Exclude()
        }
        public string ParseStatement(FileSetStatement data)
        {
            var dataToReturn = "";

            if (data.Type == "include")
            {
                dataToReturn = ".Include(";
            }
            else
            {
                dataToReturn = ".Exclude(";
            }

            var parts = data.Name.Split('/');

            for (int index = 0; index < parts.Length; index++)
            {
                if (index == 0)
                {
                    dataToReturn += parts[index] + ")";
                    continue;
                }

                if (parts[index] == "**")
                {
                    dataToReturn += ".RecurseAllSubDirectories";
                    continue;
                }

                if (index == parts.Length - 1)
                {
                    dataToReturn += ".Filter(\"" + parts[index] + "\")";
                    continue;
                }

                dataToReturn += ".Subfolder(" + parts[index] + ")";
            }

            return(dataToReturn);
        }