Beispiel #1
0
        public void FindLastLineThatContainTextTest()
        {
            var code = new List <string>
            {
                "<Project>",
                "  <ItemGroup>",
                "    <Compile Include=\"File1.cs\"",
                "    <Compile Include=\"File2.cs\"",
                "    <Compile Include=\"File3.cs\"",
                "  </ItemGroup>",
                "</Project>"
            };
            PlaceInFile result = CodeHelper.FindLastLineThatContainText(code, "<Compile Include");

            Assert.AreEqual(4, result.LineNumber);
            Assert.AreEqual("    ", result.Spaces);
        }
Beispiel #2
0
        public void FindPlaceInFileTests()
        {
            var classCode =
                new List <string>
            {
                "namespace ololo",
                "{",
                "    class blabla",
                "    {",
                "        void method ogogo()",
                "        {",
                "             return;",
                "        }",
                "    }",
                "}"
            };

            PlaceInFile place = CodeHelper.FindPlaceForMethod(classCode);

            Assert.AreEqual(8, place.LineNumber);
            Assert.AreEqual("        ", place.Spaces);
        }