예제 #1
0
        public void Constructor_Reorder()
        {
            var src1  = @"
class C
{
    public C(int a)
    {
    }

    public C(bool a)
    {
    }
}
";
            var src2  = @"
class C
{
    public C(bool a)
    {
    }

    public C(int a)
    {
    }
}";
            var edits = GetTopEdits(src1, src2);

            edits.VerifyLineEdits(
                new[]
            {
                new SourceLineUpdate(4, 8),
                AbstractEditAndContinueAnalyzer.CreateZeroDeltaSourceLineUpdate(6),
                new SourceLineUpdate(8, 4)
            });
        }
예제 #2
0
        public void Method_LineChange3()
        {
            var src1  = @"
class C
{
    static int X() => 1;

    static int Y() => 1;
}
";
            var src2  = @"
class C
{

    static int X() => 1;
    static int Y() => 1;
}";
            var edits = GetTopEdits(src1, src2);

            edits.VerifyLineEdits(
                new[]
            {
                new SourceLineUpdate(3, 4),
                AbstractEditAndContinueAnalyzer.CreateZeroDeltaSourceLineUpdate(4)
            });
        }
예제 #3
0
        public void Method_Reorder2()
        {
            var src1  = @"
class Program
{
    static void Main()
    {
        Goo();
        Bar();
    }

    static int Goo()
    {
        return 1;
    }

    static int Bar()
    {
        return 2;
    }
}";
            var src2  = @"
class Program
{
    static int Goo()
    {
        return 1;
    }

    static void Main()
    {
        Goo();
        Bar();
    }

    static int Bar()
    {
        return 2;
    }
}";
            var edits = GetTopEdits(src1, src2);

            edits.VerifyLineEdits(
                new[]
            {
                new SourceLineUpdate(4, 9),
                AbstractEditAndContinueAnalyzer.CreateZeroDeltaSourceLineUpdate(8),
                new SourceLineUpdate(10, 4),
                AbstractEditAndContinueAnalyzer.CreateZeroDeltaSourceLineUpdate(13),
            },
                Array.Empty <string>());
        }
예제 #4
0
        public void Method_Reorder1()
        {
            var src1  = @"
class C
{
    static void Goo()
    {
        Console.ReadLine(1);
    }

    static void Bar()
    {
        Console.ReadLine(2);
    }
}
";
            var src2  = @"
class C
{
    static void Bar()
    {
        Console.ReadLine(2);
    }

    static void Goo()
    {
        Console.ReadLine(1);
    }
}";
            var edits = GetTopEdits(src1, src2);

            edits.VerifyLineEdits(
                new[]
            {
                new SourceLineUpdate(4, 9),
                AbstractEditAndContinueAnalyzer.CreateZeroDeltaSourceLineUpdate(7),
                new SourceLineUpdate(9, 4)
            },
                Array.Empty <string>());
        }