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
when i use MockBehavior.Strict, vscode is not showing the error details. instead it shows this:
note that i am using linux so the path is not even valid.
here is what dotnet test gives me:
[xUnit.net 00:00:00.50] server.Tests.Services.Registration.RegistrationServiceTest.SendOtpAsync_RateLimit [FAIL]
Failed server.Tests.Services.Registration.RegistrationServiceTest.SendOtpAsync_RateLimit [39 ms]
Error Message:
Moq.MockException : ITimeService.Now invocation failed with mock behavior Strict.
All invocations on the mock must have a corresponding setup.
Stack Trace:
at Moq.FailForStrictMock.Handle(Invocation invocation, Mock mock) in C:\projects\moq4\src\Moq\Interception\InterceptionAspects.cs:line 182
at Moq.Mock.Moq.IInterceptor.Intercept(Invocation invocation) in C:\projects\moq4\src\Moq\Interception\Mock.cs:line 27
at Moq.CastleProxyFactory.Interceptor.Intercept(IInvocation underlying) in C:\projects\moq4\src\Moq\Interception\CastleProxyFactory.cs:line 107
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Castle.Proxies.ITimeServiceProxy.get_Now()
at server.Services.Registration.RegistrationService.SendOtpAsync(String email, String username) in /home/user/Documents/projects/server/server/Services/Registration/RegistrationService.cs:line 136
at server.Tests.Services.Registration.RegistrationServiceTest.SendOtpAsync_RateLimit() in /home/user/Documents/projects/server/server.Tests/Services/Registration/RegistrationServiceTest.cs:line 118
--- End of stack trace from previous location ---
Steps To Reproduce
var service = new Mock<IService>(MockBehavior.Strict);
Expected Behavior
shows the error correctly
Environment Information
OS: Ubuntu 23.04
v2.0.283
The text was updated successfully, but these errors were encountered:
The moq.dll that is packaged in the nuget package was built on a windows machine, and includes embedded symbols with file paths that reflect the code on that build machine. Note that your stack trace from the dotnet test command line also shows windows paths. When the test is run, C# Dev Kit finds the location at the top of the error stack and informs the VS Code test explorer the source location where the error was encountered. VS Code tries to open this file location, which if the source is not found locally gives the behavior you've reported.
I have made a change to not report the source location of the error when that source location does not exist locally. This will prevent the VS Code test explorer from trying to open the file locally in that case. This change will ship in the next preview build of C# Dev Kit.
Describe the Issue
when i use
MockBehavior.Strict
, vscode is not showing the error details. instead it shows this:note that i am using linux so the path is not even valid.
here is what
dotnet test
gives me:Steps To Reproduce
var service = new Mock<IService>(MockBehavior.Strict);
Expected Behavior
shows the error correctly
Environment Information
The text was updated successfully, but these errors were encountered: