WebJan 22, 2024 · However, upon calling Setup I'm getting below exception : System.NotSupportedException : Unsupported expression: x => x.PublishEventsAsync(It.IsAny(), It.IsAny>(), CancellationToken) Extension methods (here: … WebAug 3, 2024 · I'm trying to mock Entity Frameworks DbContext using Moq and in particular its extension methods Add(), Tolist() and Find(). I need the Find() and ToList() methods to actually return values stored in my mockContext.Object.. I've created my DbSet and set following properties:
Mocking extension methods used on a mocked object …
WebFeb 19, 2010 · Reason why it is not possible to mock an extension method is already given in good answers. I am just trying to give another possible solution with this answer: … WebNov 19, 2024 · With RhinoMocks we are able to Stub/Expect on extension methods. With Moq unfortunately the Setup on extension methods is unsupported, throwing an "System.NotSupportedException" expection. At the moment this deficit is a show-stopper for us, because we have tons of DLLs which make extensive use of extension methods. clindamicina bula pdf injetavel
c# - Mock Response.Header (Invalid setup on an …
WebAug 30, 2024 · Here's something for you to try: Drop the explicit generic type parameter specification, and declare dummy as object, so that you'll set up the non-generic … WebAug 10, 2024 · It is to mock the HttpContext.Request since the controller methods need to get request header values. _mockHttpContext = new Mock (); … WebMay 17, 2024 · Sets up the discovered proxy method's return value. There are also parts in Moq 4 that work with a recorder-like mode (notably, when you use SetupSet), but it's … clindamycin za sta se koristi