Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 2d90bb2

Browse files
committed
Merge pull request #2892 from mellinoe/fix-typeextensions-test
Fix order-dependent TypeExtensions tests
2 parents b3451ec + 2c77700 commit 2d90bb2

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/System.Reflection.TypeExtensions/tests/EventInfo/EventInfoAddEventHandler.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,41 +15,38 @@ public class EventInfoAddEventHandler
1515
{
1616
// Positive Test 1: add Event handler to the not static event
1717
[Fact]
18-
[ActiveIssue(2619, PlatformID.Linux)]
1918
public void PosTest1()
2019
{
2120
TestClass1 tc1 = new TestClass1();
2221
Type tpA = tc1.GetType();
2322
EventInfo eventinfo = tpA.GetEvent("Event1");
2423
eventinfo.AddEventHandler(tc1, new TestForEvent1(tc1.method1));
2524
tc1.method();
26-
Assert.Equal(1, TestClass1.m_StaticVariable);
25+
Assert.Equal(1, TestClass1.StaticVariable1);
2726
}
2827

2928
// Positive Test 2:add to Event handler to the static event and the target is null
3029
[Fact]
31-
[ActiveIssue(2619, PlatformID.Linux)]
3230
public void PosTest2()
3331
{
3432
TestClass1 tc1 = new TestClass1();
3533
Type tpA = tc1.GetType();
3634
EventInfo eventinfo = tpA.GetEvent("Event2");
3735
eventinfo.AddEventHandler(null, new TestForEvent1(tc1.method2));
3836
tc1.method();
39-
Assert.Equal(0, TestClass1.m_StaticVariable);
37+
Assert.Equal(-1, TestClass1.StaticVariable2);
4038
}
4139

4240
// Positive Test 3:add to Event handler to the static event and the target is not null
4341
[Fact]
44-
[ActiveIssue(2619, PlatformID.Linux)]
4542
public void PosTest3()
4643
{
4744
TestClass1 tc1 = new TestClass1();
4845
Type tpA = tc1.GetType();
4946
EventInfo eventinfo = tpA.GetEvent("Event2");
5047
eventinfo.AddEventHandler(tc1, new TestForEvent1(tc1.method3));
5148
tc1.method();
52-
Assert.Equal(0, TestClass1.m_StaticVariable);
49+
Assert.Equal(1, TestClass1.StaticVariable3);
5350
}
5451

5552
// Negative Test 1:add to Event handler to the not static event and the target is null
@@ -112,7 +109,10 @@ public void NegTest3()
112109

113110
public class TestClass1
114111
{
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+
116116
public readonly int m_ConstVariable = 0;
117117
public event TestForEvent1 Event1;
118118
public static event TestForEvent1 Event2;
@@ -135,15 +135,15 @@ public void method()
135135
}
136136
public void method1()
137137
{
138-
m_StaticVariable++;
138+
StaticVariable1++;
139139
}
140140
protected internal void method2()
141141
{
142-
m_StaticVariable--;
142+
StaticVariable2--;
143143
}
144144
public void method3()
145145
{
146-
m_StaticVariable++;
146+
StaticVariable3++;
147147
}
148148
}
149149
public class TestClass2

0 commit comments

Comments
 (0)