Thanks for asking the question. As Environment is a static type, you can't use it directly as a generic argument. The compiler simply doesn't allow that. Also, looking at your test, I would like to inform you that Arg.IsAny
does not have any effect at Mock.Partial
that only setups the interceptor for mocking the specified framework member.
As an example let me rewrite the test, just to give a head start.
Firstly, in test initialization you will partially setup the target member for mocking in the following way:
// static mscorlib members other than File, DateTime
>((i, j) => Environment.GetFolderPath(i));
Then, the rest is similar to mocking any other member, where you add your criteria for that member using helpers like Arg.IsAny<T>():
Mock.Arrange(() => Environment.GetFolderPath(Arg.IsAny<Environment.SpecialFolder>())).Returns(expected);
Hope the information is useful.
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking
system and vote to affect the priority of the items