Exemple #1
0
 public void TestStatementsAndExpressions()
 {
     string[] expected =
     {
         "Namespace Test.Namespace",
         "    Public Class TestClass",
         "        Public Sub Method()",
         "            New [Class]() {New A(), New A(Me.field, arg)}",
         "            New Double((arg * avar) - 1) {}",
         "            avar(CType(5.5F, Integer), Math.Abs(-2))",
         "            CType(Nothing, UInteger)",
         "            GetType(Integer)",
         "            Dim i As Integer = 0",
         "            While i < 10",
         "                Try",
         "                    AddHandler MyBase.EventsHolder.AnEvent, AddressOf Me.Method",
         "                Catch e As Exception",
         "                Catch e As AnotherException",
         "                End Try",
         "                i = i + 1",
         "            End While",
         "        End Sub",
         "    End Class",
         "End Namespace"
     };
     ProviderTestUtils.DoVisualBasicTest(expected, ProviderTestUtils.TestStatementsAndExpressionsCompileUnit());
 }
Exemple #2
0
 public void TestStatementsAndExpressions()
 {
     string[] expected = new string[]
     {
         "namespace Test.Namespace",
         "{",
         "    public class TestClass",
         "    {",
         "        public void Method()",
         "        {",
         "            new Class[] {new A(), new A(this.field, arg)};",
         "            new double[arg * avar];",
         "            avar[(int) 5.5f, Math.Abs(-2)];",
         "            default(uint);",
         "            typeof(int);",
         "            for (int i = 0; i < 10; i = i + 1)",
         "            {",
         "                try",
         "                {",
         "                    base.EventsHolder.AnEvent += new Action(this.Method);",
         "                }",
         "                catch (Exception e)",
         "                {",
         "                }",
         "                catch (AnotherException e)",
         "                {",
         "                }",
         "            }",
         "        }",
         "    }",
         "}"
     };
     ProviderTestUtils.DoCSharpTest(expected, ProviderTestUtils.TestStatementsAndExpressionsCompileUnit());
 }