I'm using MoqMockingKernel
following the example from the wiki but the Get()
method is missing. My simplified code:
using Moq;
using Ninject.MockingKernel.Moq;
namespace Store.Web.Tests.Controllers
{
[TestClass]
public class PeopleControllerTests
{
private MoqMockingKernel _mockingKernel;
[TestInitialize]
public void SetUp()
{
_mockingKernel = new MoqMockingKernel();
}
[TestMethod]
public void AddAnotherPersonAddsAnotherPerson()
{
// There is no Get method on _mockingKernel
var peopleController = _mockingKernel.Get<PeopleController>();
}
}
}
What am I doing wrong here? It has GetHashCode()
, GetMock()
, GetModules()
, and GetType()
but no Get()
.
Finally figured it out. Get()
is an extension method that lives in the Ninject.ResolutionExtensions
class. Adding using Ninject;
solved the problem. None of the examples show which namespaces you need to use which is frustrating.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With