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
var mockContext = new Mock<TaskOrchestrationContext>();
mockContext
.Setup(x => x.CallHttpAsync(HttpMethod.Get, new Uri("https://learn.microsoft.com/en-us/azure/azure-functions/dotnet-isolated-process-guide?tabs=linux"), null, null))
.ReturnsAsync(new DurableHttpResponse(System.Net.HttpStatusCode.OK));
But I get the error
System.NotSupportedException : Unsupported expression: x => x.CallHttpAsync(HttpMethod.Get, ltiUserGetUrl, null, null) Extension methods (here: TaskOrchestrationContextExtensionMethods.CallHttpAsync) may not be used in setup / verification expressions.
I see some posts online about creating a wrapper for mocking extension methods; however, with CallHttpAsync being the recommended way to make http calls in Functions I feel like I'm missing an easier way to mock and hoping someone can shed some light on this for me.
Project configuration and dependencies
No response
Link to a repository that reproduces the issue
No response
The text was updated successfully, but these errors were encountered:
jviau
transferred this issue from Azure/azure-functions-dotnet-worker
Jun 12, 2024
What version of .NET does your existing project use?
.NET 6
What version of .NET are you attempting to target?
.NET 8
Description
In the in process I could do something like this:
Now I am trying to do something like this
But I get the error
I see some posts online about creating a wrapper for mocking extension methods; however, with
CallHttpAsync
being the recommended way to make http calls in Functions I feel like I'm missing an easier way to mock and hoping someone can shed some light on this for me.Project configuration and dependencies
No response
Link to a repository that reproduces the issue
No response
The text was updated successfully, but these errors were encountered: