Ninject Extension Factory with Moq
===

I've been using Ninject for dependency injection and inversion of control, and I have been using Moq for testing purposes quite successfully; however, I recently came into a position in which I needed to start using the factory extension of Ninject.

I have code along the lines of:

    interface IBarFactory
    {
        Bar CreateBar();
    }
    
    class Bar : IBar
    {
        ...
    }
    
    class BarModule
    {
        public override void Load()
        {
            Bind<IBarFactory>().ToFactory();
        }
    }
    
    class Tests
    {
        [Fact]
        public void TestMethod()
        {
            var bar = new Mock<IBar>();
            bar.Setup(b => b.DoSomething())
                .Verifiable();
    
            var barFactory = new Mock<IBarFactory>();
            cryptoKeyFactoryMock.Setup(f => f.CreateBar())
                .Returns(bar.Object)
                .Verifiable();
    
            var someOtherClass = new SomeOtherClass(barFactory.Object);
        }
    }

When attempting to force the IBarFactory mock to return an IBar mocked object, I get an error due to the fact that the CreateBar() method expects a Bar typed object rather than an IBar typed one.

Has anyone had more success using Moq with Ninject Factory?