Skip to content

AutoMoq not working anymore with registered type in container #38

Open
@LoOnGitH

Description

@LoOnGitH

I just upgraded from version 1.6.2 to version 2.0 and a lot of my unit tests are now failing because AutoMoq seems to not take into account types that are directly registered in the container.

As an example, this test is working fine with version 1.6.2 but is failing in version 2.0. Now, obj is of type IFooProxy, just like IFoo was not registered.

    [Test]
    public void Test_With_My_Container()
    {
        var container = new UnityContainer();
        var mocker = new AutoMoqer(container);
        // container.Resolve<IFoo>(); // If uncommenting this line, test pass

        container.RegisterType<IFoo, Foo>();
        var obj = container.Resolve<IFoo>();
        obj.ShouldBeType<Foo>();
    }

Am I missing something ?

Thanks !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions