Beispiel #1
0
        public void TestModelBracketInsert()
        {
            var doc = new List <string>
            {
                "// hello",
                "{",
                "var x = y.Func1(x =>",
                "\t(isZ ? 0 : 1));",
                "}"
            };

            var fm = new FileModel(doc);

            fm.FindLineContains("Func1(");
            bool succeed = fm.InsertTextAfterMatchingBracket("Func1(", ".qqq()");

            Assert.True(succeed, "Insert Text failed");
            Assert.Equal("\t(isZ ? 0 : 1)).qqq();", doc[3]);

            fm.ToTop();
            fm.FindLineIs("{");
            succeed = fm.InsertTextAfterMatchingBracket("{", "bbb", '{', '}');
            Assert.True(succeed, "Insert text after } failed");
            Assert.Equal("}bbb", doc[4]);
        }