Thanks again for reporting the issue. This is a known issue with MockClassAttribute
which is if you apply the attribute to FileManager
class then things work as expected. Of course this an issue to fix and we are working on it.
However, in your test class one thing I have noticed that you use Mock.Initialize
instead of Directory
is originally meant for initializing mscorlib members and pre-intercepting members so that if invoked manually (e.g. new Foo().Submit() that invokes OnJITCompilation started and therefore cannot be intercepted in later test via profiler) does not fail the mocked called (in large tests). Therefore, you can simply write the following line in static constructor and it will suffice.
Here you don’t need the extra Mock.Initialize
class. I have also attached the updated project to let you have a look.
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>