2004-09-23 Zoltan Varga <vargaz@freemail.hu>
[mono.git] / mcs / btests / ClassTest.vb
1 Imports System
2 Class C1
3         Public a As Integer=47
4         Public Sub S()
5                 Dim myInnerC As New C2()
6                 Dim b As Integer=myInnerC.H()
7                 If b<>147 Then
8                         Throw New Exception("#A5:Error in accessing inner class")
9                 End If
10         End Sub
11         Public Function G() As Integer
12                 Return 38
13         End Function
14         Class C2
15                 Public Function H() As Integer
16                         Return 147
17                 End Function
18         End Class
19 End Class
20 Module M
21         Sub Main()
22                 Try
23                         Dim myCInstance As New C1()
24                 Catch e As Exception
25                         Console.WriteLine("#A1:Error in creating class instance:"+e.Message)
26                 End Try
27                 
28                 Dim myC As New C1()
29
30                 Try
31                         If myC.a<>47 Then
32                                 Throw New Exception("#A2-ClassTest:Failed-Error in accessing class data member")
33                         End If
34                 Catch e As Exception
35                         Console.WriteLine(e.Message)
36                 End Try
37                 
38                 Try
39                         myC.S()
40                 Catch e As Exception
41                         Console.WriteLine("#A3:Error in accessing Sub from a class:"+e.Message)
42                 End Try
43                 
44                 Try
45                         Dim c As Integer=myC.G()
46                         If c<>38 Then
47                                 Throw New Exception("#A4-ClassTest:Failed-Error in  accessing Function of a class")
48                         End If
49                 Catch e As Exception
50                         Console.WriteLine(e.Message)
51                 End Try
52         End Sub
53 End Module