Ejemplo n.º 1
0
 public void IsDirty5()
 {
     string raw = "        [Authorize]\r\n        public ActionResult Edit(int id)\r\n";
     bool expected = true;
     bool actual = new PasteCleaner(raw).IsDirty();
     Assert.AreEqual(expected, actual);
 }
Ejemplo n.º 2
0
 public void IsDirty4()
 {
     string raw = "01. <PropertyGroup> \r\n02.   <DeployOnBuild Condition=\" '$(DeployProjA)'!='' \">$(DeployProjA)</DeployOnBuild> \r\n03. </PropertyGroup> \r\n";
     bool expected = true;
     bool actual = new PasteCleaner(raw).IsDirty();
     Assert.AreEqual(expected, actual);
 }
Ejemplo n.º 3
0
        public void IsDirty1()
        {
            string raw = "public static string RemoveWhiteSpaceFromStylesheets(string body)\r\n\r\n{\r\n\r\n  body = Regex.Replace(body, @\"[a-zA-Z]+#\", \"#\");\r\n\r\n  body = Regex.Replace(body, @\"[\\n\\r]+\\s*\", string.Empty);\r\n\r\n  body = Regex.Replace(body, @\"\\s+\", \" \");\r\n\r\n  body = Regex.Replace(body, @\"\\s?([:,;{}])\\s?\", \"$1\");\r\n\r\n  body = body.Replace(\";}\", \"}\");\r\n\r\n  body = Regex.Replace(body, @\"([\\s:]0)(px|pt|%|em)\", \"$1\");\r\n\r\n \r\n\r\n  // Remove comments from CSS\r\n\r\n  body = Regex.Replace(body, @\"/\\*[\\d\\D]*?\\*/\", string.Empty);\r\n\r\n \r\n\r\n  return body;\r\n\r\n}\r\n";
            bool expected = true;
            bool actual = new PasteCleaner(raw).IsDirty();

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 4
0
        public void IsDirty1()
        {
            string raw      = "public static string RemoveWhiteSpaceFromStylesheets(string body)\r\n\r\n{\r\n\r\n  body = Regex.Replace(body, @\"[a-zA-Z]+#\", \"#\");\r\n\r\n  body = Regex.Replace(body, @\"[\\n\\r]+\\s*\", string.Empty);\r\n\r\n  body = Regex.Replace(body, @\"\\s+\", \" \");\r\n\r\n  body = Regex.Replace(body, @\"\\s?([:,;{}])\\s?\", \"$1\");\r\n\r\n  body = body.Replace(\";}\", \"}\");\r\n\r\n  body = Regex.Replace(body, @\"([\\s:]0)(px|pt|%|em)\", \"$1\");\r\n\r\n \r\n\r\n  // Remove comments from CSS\r\n\r\n  body = Regex.Replace(body, @\"/\\*[\\d\\D]*?\\*/\", string.Empty);\r\n\r\n \r\n\r\n  return body;\r\n\r\n}\r\n";
            bool   expected = true;
            bool   actual   = new PasteCleaner(raw).IsDirty();

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 5
0
        public void IsDirty5()
        {
            string raw      = "        [Authorize]\r\n        public ActionResult Edit(int id)\r\n";
            bool   expected = false;
            bool   actual   = new PasteCleaner(raw).IsDirty();

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 6
0
        public void IsDirty4()
        {
            string raw      = "01. <PropertyGroup> \r\n02.   <DeployOnBuild Condition=\" '$(DeployProjA)'!='' \">$(DeployProjA)</DeployOnBuild> \r\n03. </PropertyGroup> \r\n";
            bool   expected = true;
            bool   actual   = new PasteCleaner(raw).IsDirty();

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 7
0
        public void LineNumberFirefox()
        {
            string raw      = "1\t<PropertyGroup>\r\n2\t  <DeployOnBuild Condition=\" '$(DeployProjA)'!='' \">$(DeployProjA)</DeployOnBuild>\r\n3\t</PropertyGroup>";
            string expected = "<PropertyGroup>\r\n  <DeployOnBuild Condition=\" '$(DeployProjA)'!='' \">$(DeployProjA)</DeployOnBuild>\r\n</PropertyGroup>";

            _cleaner = new PasteCleaner(raw);
            _cleaner.IsDirty();

            string actual = _cleaner.Clean();

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 8
0
        public void MinusGitHub()
        {
            string raw      = "-        private const string _regex = @\"^([\\d]+|\\+|\\-)(\\s|\\.)?\";\r\n-        private const string _regex = @\"^([\\d]+|\\+|\\-)(\\s|\\.)?\";\r\n-        private const string _regex = @\"^([\\d]+|\\+|\\-)(\\s|\\.)?\";\r\n";
            string expected = "       private const string _regex = @\"^([\\d]+|\\+|\\-)(\\s|\\.)?\";\r\n       private const string _regex = @\"^([\\d]+|\\+|\\-)(\\s|\\.)?\";\r\n       private const string _regex = @\"^([\\d]+|\\+|\\-)(\\s|\\.)?\";";

            _cleaner = new PasteCleaner(raw);
            _cleaner.IsDirty();

            string actual = _cleaner.Clean();

            Assert.AreEqual(expected, actual);
        }