Hi,
I've been trying to mock calls the the System.Environment class in MsCorlib.
I followed the guidelines in the documentation:
I've been trying to mock calls the the System.Environment class in MsCorlib.
I followed the guidelines in the documentation:
- I created the class with the MockClass attribute:
[TestClass, MockClass]
public class UnitTest1
- I tried to use the partial method:
Mock.Partial<
Environment
>().For<
string
>((x) => Environment.GetFolderPath(Arg.IsAny<
Environment.SpecialFolder
>()));
But this doesn't feel right (the lambda uses an instance but the class is static) and it does not compile for the same reason: cannot use static types as type arguments.
Is there a way to mock static mscorlib classes? (Environment.GetFolderPath)
Thanks!
DenisCL
Is there a way to mock static mscorlib classes? (Environment.GetFolderPath)
Thanks!
DenisCL