public void SpecialBlocks_Using_Statement()
        {
            const string code = @"
public class Class1
{
    public void Foo(Func<IDisposable> factory)
    {
        using (var x = factory())   // Jump(Next:UsingEnd)      | Basic#0(Jump:#1)
        {
                                    // UsingEnd(Next:Exit)      | Basic#1(Jump:#2)
        }
                                    // Exit                     | Basic#2(Ret:Const)
    }
}";
            var          ucfg = UcfgVerifier.GetUcfgForMethod(code, "Foo");

            TestHelper.AssertCollection(ucfg.BasicBlocks,
                                        b => ValidateJmpBlock(b, expectedId: "0", expectedJumps: new[] { "1" }),
                                        b => ValidateJmpBlock(b, expectedId: "1", expectedJumps: new[] { "2" }),
                                        b => ValidateRetBlock(b, expectedId: "2", expectedReturnExpression: ConstValue)
                                        );
        }
        public void SpecialBlocks_For()
        {
            const string code = @"
public class Class1
{
    public void Foo(string[] items)
    {
        for (int i = 0; i < items.Length; i++)      // For(BinaryBranch)                |   Basic#0(Jump:#1)
                                                    // BinaryBranch(Simple,Exit)        |   Basic#1(Jump:#2,#3)
        {                                           // Simple(BinaryBranch)             |   Basic#2(Jump:#1)
        }
    }                                               // Exit                             |   Basic#3(Ret)
}";
            var          ucfg = UcfgVerifier.GetUcfgForMethod(code, "Foo");

            TestHelper.AssertCollection(ucfg.BasicBlocks,
                                        b => ValidateJmpBlock(b, expectedId: "0", expectedJumps: new[] { "1", }),
                                        b => ValidateJmpBlock(b, expectedId: "1", expectedJumps: new[] { "2", "3" }),
                                        b => ValidateJmpBlock(b, expectedId: "2", expectedJumps: new[] { "1" }),
                                        b => ValidateRetBlock(b, expectedId: "3", expectedReturnExpression: ConstValue)
                                        );
        }
        public void Serialize_Some_Method()
        {
            var code = @"
class C
{
    void Foo(string a, string b)
    {
        var x = a + b;
        if (true)
        {
            Bar(a, 1);
        }
        else
        {
            Bar(b, 2);
        }
    }
    void Bar(string a, int x) { }
}
";
            var dot  = UcfgSerializer.Serialize(UcfgVerifier.GetUcfgForMethod(code, "Foo"));

            dot.Should().BeIgnoringLineEndings(@"digraph ""C.Foo(string, string)"" {
ENTRY [shape=record label=""{ENTRY|a|b}""]
ENTRY -> 0
0 [shape=record label=""{BLOCK:0|\{ \""name\"": \""%0\"" \} __concat a,b|\{ \""name\"": \""x\"" \} __id %0|TERMINATOR JUMP: 1, 2}""]
0 -> 1
0 -> 2
1 [shape=record label=""{BLOCK:1|\{ \""name\"": \""%1\"" \} C.Bar(string, int) _this_,a,\""\""\""\""|TERMINATOR JUMP: 3}""]
1 -> 3
2 [shape=record label=""{BLOCK:2|\{ \""name\"": \""%2\"" \} C.Bar(string, int) _this_,b,\""\""\""\""|TERMINATOR JUMP: 3}""]
2 -> 3
3 [shape=record label=""{BLOCK:3|TERMINATOR RET: \""\""\""\""}""]
3 -> END
END [shape=record label=""{END}""]
}
");
        }
        public void Void_Method_Branch1()
        {
            const string code = @"
using System;
public class Class1
{
    public void Foo(string s)
    {
        if (true)                   // Branch (Next:Jump,Exit)  | Block#0(Jump:#1,#2)
            return;                 // Jump   (Next:Exit)       | Block#1(Ret)
                                    // Exit                     | Block#2(Ret)
    }
}";
            var          ucfg = UcfgVerifier.GetUcfgForMethod(code, "Foo");

            ucfg.Entries.Should().BeEquivalentTo(new[] { "0" });

            TestHelper.AssertCollection(ucfg.BasicBlocks,
                                        b => ValidateJmpBlock(b, expectedId: "0", expectedJumps: new[] { "1", "2" }),
                                        b => ValidateRetBlock(b, expectedId: "1", expectedReturnExpression: ConstValue),
                                        b => ValidateRetBlock(b, expectedId: "2", expectedReturnExpression: ConstValue)
                                        );
        }
        public void Throw_Exception()
        {
            const string code = @"
public class Class1
{
    public string Foo(string s)
    {
        if (true)                       // Branch(Jump,Exit)    |   Basic#0(Jump:#1,#2)
        {
            throw new Exception();      // Jump(Exit)           |   Basic#1(Jump:#3)
        }
        return s;                       // Jump(Exit)           |   Basic#2(Ret:s)
    }                                   // Exit                 |   Basic#3(Ret:Const)
}";
            var          ucfg = UcfgVerifier.GetUcfgForMethod(code, "Foo");

            ucfg.Entries.Should().BeEquivalentTo(new[] { "0" });

            TestHelper.AssertCollection(ucfg.BasicBlocks,
                                        b => ValidateJmpBlock(b, expectedId: "0", expectedJumps: new[] { "1", "2" }),
                                        b => ValidateJmpBlock(b, expectedId: "1", expectedJumps: "3"),
                                        b => ValidateRetBlock(b, expectedId: "2", expectedReturnExpression: "s"),
                                        b => ValidateRetBlock(b, expectedId: "3", expectedReturnExpression: ConstValue));
        }