示例#1
0
        public void TestBasicTransformation()
        {
            SourceCode           source         = new SourceCode("abc123");
            SourceTransformation transformation = new SourceTransformation(new SourceContext(0, 3), n => "a");
            string transformed = SourceFormatter.Format(source, transformation);

            Assert.AreEqual(transformed, "aaa123");
        }
示例#2
0
        public void TestNestedTransformation()
        {
            SourceCode           source          = new SourceCode("1111111");
            SourceTransformation transformation1 = new SourceTransformation(new SourceContext(2, 3), n => "2");
            SourceTransformation transformation2 = new SourceTransformation(new SourceContext(3, 1), n => "3");
            string transformed = SourceFormatter.Format(source, transformation1, transformation2);

            Assert.AreEqual(transformed, "1123211");
        }