Skip to content

Commit c779ae2

Browse files
committed
The static constructor of a type disrespects previously created arrangements when triggered by the Telerik.JustMock.PrivateAccessor class
o added call to Mock.Intercept in the private constructor of the PrivateAccessor class
1 parent 7d7259f commit c779ae2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Telerik.JustMock/PrivateAccessor.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
JustMock Lite
3-
Copyright © 2010-2015,2018 Progress Software Corporation
3+
Copyright © 2010-2015,2018-2019 Progress Software Corporation
44
55
Licensed under the Apache License, Version 2.0 (the "License");
66
you may not use this file except in compliance with the License.
@@ -94,12 +94,18 @@ private PrivateAccessor(object instance, Type type)
9494
#if (!COREFX && !NETCORE)
9595
var realProxy = MockingProxy.GetRealProxy(instance);
9696
if (realProxy != null)
97+
{
9798
instance = realProxy.WrappedInstance;
99+
}
98100
#endif
99101
type = instance.GetType();
100102
}
101103
if (type.IsProxy() && type.BaseType != typeof(object))
104+
{
102105
type = type.BaseType;
106+
}
107+
108+
Mock.Intercept(type);
103109
});
104110

105111
this.instance = instance;

0 commit comments

Comments
 (0)