About 71,700,000 results
Open links in new tab
  1. c# - What is use of Moq? - Stack Overflow

    Mar 24, 2009 · Moq is a mocking framework for C#/.NET. It is used in unit testing to isolate your class under test from its dependencies and ensure that the proper methods on the dependent …

  2. c# - Mock.Of<Object> VS Mock<Object> () - Stack Overflow

    May 5, 2016 · I'm currently confuse on how to mock. I'm using Moq. To mock objects I usually write this way var mockIRepo = new Mock&lt;IRepo&gt;(); However, I need to create mock …

  3. c# - Moq: How to get to a parameter passed to a method of a …

    Moq is good at letting you know whether there was a matching call, but specific asserts give you much better information. The main drawback to my approach is losing the type safety and …

  4. What is the purpose of Verifiable() in Moq? - Stack Overflow

    What is the purpose of Verifiable()? If I verify a Mock and leave this out it still verifies the SetUp. Edit: I was using VerifyAll() thus the reason for everything being verified. After changing...

  5. Using Moq to mock only some methods - Stack Overflow

    Using Moq to mock only some methods Asked 14 years, 10 months ago Modified 2 years, 6 months ago Viewed 90k times

  6. c# - .NET Core Unit Testing - Mock IOptions<T> - Stack Overflow

    Nov 30, 2016 · 2 Here is the sample code to test the IOptions and IOptionsMonitor using Interface (Convert IOptions to IConfigurationClass and then test using the Interface) To Learn more …

  7. c# - Moq - Non-overridable members may not be used in setup ...

    Jul 5, 2019 · Moq - Non-overridable members may not be used in setup / verification expressions Asked 6 years, 4 months ago Modified 1 year, 8 months ago Viewed 249k times

  8. Multiple Moq It.Is<string> () Matching Arguments

    Feb 3, 2012 · With Moq, is it valid to have more than one Matching Argument? It.Is&lt;string&gt;() In this example I want the mockMembershipService to return a different ProviderUserKey …

  9. How to mock static methods in c# using Moq framework?

    Nov 24, 2023 · 146 Moq (and other DynamicProxy -based mocking frameworks) are unable to mock anything that is not a virtual or abstract method. Sealed/static classes/methods can only …

  10. Simulate a delay in execution in Unit Test using Moq

    Can anyone suggest a better/accurate way to use the Moq framework to simulate a delay in "delivery" of the message. I've left out some of the "glue" code and only included the relevant …