About 62,500,000 results
Open links in new tab
  1. 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 …

  2. 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 …

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

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

  4. Assigning out/ref parameters in Moq - Stack Overflow

    Is it possible to assign an out / ref parameter using Moq (3.0+)? I've looked at using Callback(), but Action<> does not support ref parameters because it's based on generics. I'd also …

  5. How to mock a function call on a concrete object with Moq?

    Oct 7, 2014 · 35 How can I do this in Moq? Foo bar = new Foo(); Fake(bar.PrivateGetter).Return('whatever value') It seems I can only find how to mock an …

  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. unit testing - When mocking a class with Moq, how can I CallBase …

    I really appreciate Moq's Loose mocking behaviour that returns default values when no expectations are set. It's convenient and saves me code, and it also acts as a safety measure: …

  8. c# - Mocking HttpClient in unit tests - Stack Overflow

    Apr 5, 2016 · Moq.Contrib.HttpClient Like the solution for using Moq by itself, this is straightforward if you are familiar with using the Moq framework. I found this solution to be …

  9. How do I use Moq to mock an extension method? - Stack Overflow

    Mocking that result seemed the obvious choice but Moq doesn't seem to offer a way to override a static method (a requirement for an extension method). There is a similar idea with …

  10. Different return values the first and second time with Moq

    Feb 9, 2017 · 4 Reached here for the same kind of problem with slightly different requirement. I need to get different return values from mock based in different input values and found …