Moq cannot mock non virtual methods on classes. Either use other mocking frameworks such as Type mock Isolator which actually weaves IL into your assembly or place an interface on EmailService
and mock that.
More Related Contents:
- Is it possible to mock out a .NET HttpWebResponse?
- Using Moq to determine if a method is called
- Moq – Non-overridable members may not be used in setup / verification expressions
- How do I mock User.Identity.GetUserId()?
- Mocking generic methods in Moq without specifying T
- Get all checked nodes of a treeview
- Is DateTime.Now the best way to measure a function’s performance? [closed]
- What exactly is an “open generic type” in .NET? [duplicate]
- What is the use of ObservableCollection in .net?
- Could not find a part of the path … bin\roslyn\csc.exe
- How to select min and max values of a column in a datatable?
- GetMethod for generic method [duplicate]
- Programmatically get the version number of a DLL
- How to pass a table-value parameter
- Do interfaces derive from System.Object? C# spec says yes, Eric says no, reality says no
- When is using the C# ref keyword ever a good idea?
- Event handlers not thread safe? [duplicate]
- Selecting attribute values with html Agility Pack
- How to correctly unregister an event handler
- Difference between lock(locker) and lock(variable_which_I_am_using)
- Best way to check if a Data Table has a null value in it
- Binding an enum to a WinForms combo box, and then setting it
- Use Task.Run() in synchronous method to avoid deadlock waiting on async method?
- Convert Transparent PNG to JPG with Non-Black Background Color
- Sql Bulk Copy/Insert in C#
- Target 32 Bit or 64 Bit native DLL depending on environment
- Creating an empty file in C#
- What is the use case for the (C# 7.2) “private protected” modifier?
- Method Overloading with different return type [duplicate]
- Remove top and bottom padding from Text drawn on an Image