Skip to content

Commit 0fb5e1a

Browse files
committed
Rename CSharpUtils.Reflect.Get to CSharpUtils.Reflect.ObjectGet to work around an apparent bug in the Jenkins code coverage plugin related to method overloading
1 parent 9ebece6 commit 0fb5e1a

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

QuickVsix/CSharpUtils/Reflection/Reflect.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public static FieldInfo GetFieldInfo(Type type, string fieldName)
1818
return instanceField;
1919
}
2020

21-
public static object Get(object obj, string fieldName)
21+
public static object ObjectGet(object obj, string fieldName)
2222
{
2323
Type objectType = obj.GetType();
2424
FieldInfo instanceField = GetFieldInfo(objectType, fieldName);
@@ -29,7 +29,7 @@ public static object Get(object obj, string fieldName)
2929

3030
public static T Get<T>(object obj, string fieldName)
3131
{
32-
T instanceField = (T)Get(obj, fieldName);
32+
T instanceField = (T)ObjectGet(obj, fieldName);
3333
return instanceField;
3434
}
3535

QuickVsixTests/CSharpUtils/Reflection/ReflectTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ public static void GetAndSet_GetsAndSetInstanceFields_ThrowsIfFieldsNotFoundOrNo
4646
{
4747
var x = new X();
4848

49-
Assert.AreEqual(0, Reflect.Get(x, "x"));
50-
Assert2.Throws<ArgumentException>(() => Reflect.Get(x, "x123"),
49+
Assert.AreEqual(0, Reflect.ObjectGet(x, "x"));
50+
Assert2.Throws<ArgumentException>(() => Reflect.ObjectGet(x, "x123"),
5151
"Field not found: ReflectTests+X.x123");
5252

5353
Reflect.Set(x, "x", 10);
54-
Assert.AreEqual(10, Reflect.Get(x, "x"));
54+
Assert.AreEqual(10, Reflect.ObjectGet(x, "x"));
5555
Assert2.Throws<ArgumentException>(() => Reflect.Set(x, "x123", 10),
5656
"Field not found: ReflectTests+X.x123");
5757
Assert2.Throws<ArgumentException>(() => Reflect.Set(x, "x", "not_an_int"),

QuickVsixTests/CSharpUtils/UnitTesting/Assert2.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public static void EqualsThrowsInvalidCastExceptionWhenComparedWithANewObject_No
104104

105105
public static void FieldIsNull(object obj, string fieldName)
106106
{
107-
object field = Reflect.Get(obj, fieldName);
107+
object field = Reflect.ObjectGet(obj, fieldName);
108108
Assert.IsNull(field, "Regarding field \"" + fieldName + "\"");
109109
}
110110

0 commit comments

Comments
 (0)