public void AddCancellationTokenParam()
        {
            var code = @"public class HelloWorld
                        {
                            #line 1
                            string Main()
                            {
                                return ""Hello World"";
                            }
                        }";

            var newSource = CompilationTooling.Transform(code);

            var expect = @"public class HelloWorld
                        {
                            #line 1
                            string Main(System.Threading.CancellationToken cancellationToken)
                            {
                                if (cancellationToken.IsCancellationRequested)
                                {
                                    throw new System.Threading.Tasks.TaskCanceledException();
                                }
                                #line 3
                                return ""Hello World"";
                            }
                        }";

            newSource.ToFullString().Should().BeEquivalentToIgnoreWS(expect);
        }
        public void WorkWithForEachStatements()
        {
            var code = @"public class HelloWorld
    {
#line 1
string Main(string s){
            foreach(var x in new[] {1, 2, 3})
                x++;
            return s;
        }
}";

            var newSource = CompilationTooling.Transform(code);

            var expect = @"public class HelloWorld
    {
#line 1
string Main(string s, System.Threading.CancellationToken cancellationToken){
            if (cancellationToken.IsCancellationRequested)
                {
                    throw new System.Threading.Tasks.TaskCanceledException();
                }
                #line 2
            foreach(var x in new[] {1, 2, 3})
                {
if (cancellationToken.IsCancellationRequested)
                {
                    throw new System.Threading.Tasks.TaskCanceledException();
                }
                #line 3
                x++;
                }
            return s;
        }
}";

            newSource.ToFullString().Should().BeEquivalentToIgnoreWS(expect);
        }
        public void WorkWithPrivateFunctionsInReverse()
        {
            var code = @"public class HelloWorld
    {
        #line 1
        string Main(string s)
        {
            return s + X();
        }
        private int X() => 42;
    }";

            var newSource = CompilationTooling.Transform(code);

            var expect = @"public class HelloWorld
    {
        #line 1
        string Main(string s, System.Threading.CancellationToken cancellationToken)
        {
            if (cancellationToken.IsCancellationRequested)
            {
                throw new System.Threading.Tasks.TaskCanceledException();
            }
            #line 3
            return s + X(cancellationToken);
        }
        private int X(System.Threading.CancellationToken cancellationToken){
            if (cancellationToken.IsCancellationRequested)
                {
                    throw new System.Threading.Tasks.TaskCanceledException();
                }
            #line 1
            return 42;
        }
    }";

            newSource.ToFullString().Should().BeEquivalentToIgnoreWS(expect);
        }