You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Smock.Run(context =>{ context.Setup(()=> DateTime.Now).Returns(new DateTime());//this line is required to link the shim ?varrequired= DateTime.Now;vardatetime= StaticClass.TestDatetime();varbreakHere=123;});publicclassStaticClass{publicstatic DateTime TestDateTime(){return DateTime.Now;}}
With the example code above I have to call the function DateTime.Now; within the smock otherwise it will not call the shim datetime value in my StaticClassTestDatetime() function.
The text was updated successfully, but these errors were encountered:
I was able to reproduce this issue, when StaticClass is in a different assembly as the Smock.Run call. If they are in the same assembly, it works as expected.
I'll look into this in more detail shortly and provide a fix.
With the example code above I have to call the function DateTime.Now; within the smock otherwise it will not call the shim datetime value in my StaticClassTestDatetime() function.
The text was updated successfully, but these errors were encountered: