Skip to content

Commit 601e5d7

Browse files
committed
Add extra output to unit test to help debug
1 parent 2b3ec89 commit 601e5d7

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

Tests/NFUnitTestSystemLib/UnitTestInitLocalTests.cs

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ public void SystemType1_GetType_Test()
4949
// ConstructorInfo)
5050
// NOTE: We add the reflection items to the ArrayList to assure that they can be properly
5151
// assigned to a object container (this used to lead to a access violation)
52+
53+
OutputHelper.WriteLine("Testing Int32");
54+
5255
Type type = typeof(int);
5356
list.Add(type);
5457
string name = ((Type)list[i]).Name;
@@ -68,33 +71,43 @@ public void SystemType1_GetType_Test()
6871
//fRes &= name.ToLower() == "mscorlib";
6972
//i++;
7073

74+
OutputHelper.WriteLine("Testing NFUnitTestSystemLib.UnitTestInitLocalTests+TestObj");
75+
7176
type = Type.GetType("NFUnitTestSystemLib.UnitTestInitLocalTests+TestObj");
7277
list.Add(type);
7378
name = ((Type)list[i]).Name;
7479
Assert.AreEqual(name, "TestObj");
7580
i++;
7681

82+
OutputHelper.WriteLine("Testing IEmptyInterface");
83+
7784
Type iface = type.GetInterfaces()[0];
7885
list.Add(iface);
7986
name = ((Type)list[i]).Name;
8087
Assert.AreEqual(name, "IEmptyInterface");
8188
Assert.AreEqual(iface.Name, "IEmptyInterface");
8289
i++;
8390

91+
OutputHelper.WriteLine("Testing FieldInfo");
92+
8493
FieldInfo fi = type.GetField("Field1");
8594
list.Add(fi);
8695
name = ((FieldInfo)list[i]).Name;
8796
Assert.AreEqual(name, "Field1");
8897
Assert.AreEqual(fi.Name, "Field1");
8998
i++;
9099

100+
OutputHelper.WriteLine("Testing MethodInfo");
101+
91102
MethodInfo mi = type.GetMethod("Method1");
92103
list.Add(mi);
93104
name = ((MethodInfo)list[i]).Name;
94105
Assert.AreEqual(name, "Method1");
95106
Assert.AreEqual(mi.Name, "Method1");
96107
i++;
97108

109+
OutputHelper.WriteLine("Testing ConstructorInfo");
110+
98111
ConstructorInfo ci = type.GetConstructor(new Type[] { });
99112
list.Add(ci);
100113
name = ((ConstructorInfo)list[i]).Name;
@@ -104,7 +117,10 @@ public void SystemType1_GetType_Test()
104117

105118
//
106119
// Now test arrays of reflection types
107-
//
120+
//
121+
122+
OutputHelper.WriteLine("Testing Array of Type");
123+
108124
Type[] types = new Type[] { typeof(int), typeof(bool), Type.GetType("NFUnitTestSystemLib.UnitTestInitLocalTests+TestObj") };
109125
list.Add(types[2]);
110126
name = ((Type)list[i]).Name;
@@ -127,27 +143,35 @@ public void SystemType1_GetType_Test()
127143
//fRes &= asms[0].GetName().Name == "Microsoft.SPOT.Platform.Tests.Systemlib2";
128144
//i++;
129145

146+
OutputHelper.WriteLine("Testing Array of FieldInfo");
147+
130148
FieldInfo[] fis = new FieldInfo[] { types[2].GetField("Field1"), type.GetFields()[0] };
131149
list.Add(fis[0]);
132150
name = ((FieldInfo)list[i]).Name;
133151
Assert.AreEqual(name, "Field1");
134152
Assert.AreEqual(fis[0].Name, "Field1");
135153
i++;
136154

155+
OutputHelper.WriteLine("Testing Array of MethodInfo");
156+
137157
MethodInfo[] mis = new MethodInfo[] { type.GetMethods()[2], types[2].GetMethod("Method2", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public) };
138158
list.Add(mis[1]);
139159
name = ((MethodInfo)list[i]).Name;
140160
Assert.AreEqual(name, "Method2");
141161
Assert.AreEqual(mis[1].Name, "Method2");
142162
i++;
143163

164+
OutputHelper.WriteLine("Testing Array of ConstructorInfo");
165+
144166
ConstructorInfo[] cis = new ConstructorInfo[] { types[2].GetConstructor(new Type[] { }), typeof(TestObj).GetConstructor(new Type[] { typeof(int) }) };
145167
list.Add(cis[0]);
146168
name = ((ConstructorInfo)list[i]).Name;
147169
Assert.AreEqual(name, ".ctor");
148170
Assert.AreEqual(cis[0].Name, ".ctor");
149171
i++;
150172

173+
OutputHelper.WriteLine("Testing Array of System.Collections.ArrayList");
174+
151175
Array ar = Array.CreateInstance(typeof(Type), 3);
152176
((IList)ar)[0] = typeof(Type);
153177
((IList)ar)[1] = Type.GetType("System.Collections.ArrayList");
@@ -157,7 +181,6 @@ public void SystemType1_GetType_Test()
157181
Assert.AreEqual(name, "ArrayList");
158182
Assert.AreEqual(((Type)((IList)ar)[0]).Name, "Type");
159183
Assert.AreEqual(((Type)ar.GetValue(1)).Name, "ArrayList");
160-
i++;
161184

162185
list.Clear();
163186
}

0 commit comments

Comments
 (0)