@@ -15,41 +15,38 @@ public class EventInfoAddEventHandler
15
15
{
16
16
// Positive Test 1: add Event handler to the not static event
17
17
[ Fact ]
18
- [ ActiveIssue ( 2619 , PlatformID . Linux ) ]
19
18
public void PosTest1 ( )
20
19
{
21
20
TestClass1 tc1 = new TestClass1 ( ) ;
22
21
Type tpA = tc1 . GetType ( ) ;
23
22
EventInfo eventinfo = tpA . GetEvent ( "Event1" ) ;
24
23
eventinfo . AddEventHandler ( tc1 , new TestForEvent1 ( tc1 . method1 ) ) ;
25
24
tc1 . method ( ) ;
26
- Assert . Equal ( 1 , TestClass1 . m_StaticVariable ) ;
25
+ Assert . Equal ( 1 , TestClass1 . StaticVariable1 ) ;
27
26
}
28
27
29
28
// Positive Test 2:add to Event handler to the static event and the target is null
30
29
[ Fact ]
31
- [ ActiveIssue ( 2619 , PlatformID . Linux ) ]
32
30
public void PosTest2 ( )
33
31
{
34
32
TestClass1 tc1 = new TestClass1 ( ) ;
35
33
Type tpA = tc1 . GetType ( ) ;
36
34
EventInfo eventinfo = tpA . GetEvent ( "Event2" ) ;
37
35
eventinfo . AddEventHandler ( null , new TestForEvent1 ( tc1 . method2 ) ) ;
38
36
tc1 . method ( ) ;
39
- Assert . Equal ( 0 , TestClass1 . m_StaticVariable ) ;
37
+ Assert . Equal ( - 1 , TestClass1 . StaticVariable2 ) ;
40
38
}
41
39
42
40
// Positive Test 3:add to Event handler to the static event and the target is not null
43
41
[ Fact ]
44
- [ ActiveIssue ( 2619 , PlatformID . Linux ) ]
45
42
public void PosTest3 ( )
46
43
{
47
44
TestClass1 tc1 = new TestClass1 ( ) ;
48
45
Type tpA = tc1 . GetType ( ) ;
49
46
EventInfo eventinfo = tpA . GetEvent ( "Event2" ) ;
50
47
eventinfo . AddEventHandler ( tc1 , new TestForEvent1 ( tc1 . method3 ) ) ;
51
48
tc1 . method ( ) ;
52
- Assert . Equal ( 0 , TestClass1 . m_StaticVariable ) ;
49
+ Assert . Equal ( 1 , TestClass1 . StaticVariable3 ) ;
53
50
}
54
51
55
52
// Negative Test 1:add to Event handler to the not static event and the target is null
@@ -112,7 +109,10 @@ public void NegTest3()
112
109
113
110
public class TestClass1
114
111
{
115
- public static int m_StaticVariable = 0 ;
112
+ public static int StaticVariable1 = 0 ; // Incremented by method1
113
+ public static int StaticVariable2 = 0 ; // Decremented by method2
114
+ public static int StaticVariable3 = 0 ; // Incremented by method3
115
+
116
116
public readonly int m_ConstVariable = 0 ;
117
117
public event TestForEvent1 Event1 ;
118
118
public static event TestForEvent1 Event2 ;
@@ -135,15 +135,15 @@ public void method()
135
135
}
136
136
public void method1 ( )
137
137
{
138
- m_StaticVariable ++ ;
138
+ StaticVariable1 ++ ;
139
139
}
140
140
protected internal void method2 ( )
141
141
{
142
- m_StaticVariable -- ;
142
+ StaticVariable2 -- ;
143
143
}
144
144
public void method3 ( )
145
145
{
146
- m_StaticVariable ++ ;
146
+ StaticVariable3 ++ ;
147
147
}
148
148
}
149
149
public class TestClass2
0 commit comments