GithubHelp home page GithubHelp logo

Comments (5)

darrencauthon avatar darrencauthon commented on May 21, 2024

Thank you for the failing test. I've started a pull request to resolve it. I'll post an update as soon as I have a fix.

from automoq.

darrencauthon avatar darrencauthon commented on May 21, 2024

@kszepieto The issue seems to be calling Create twice, so I believe that's something I'll be able to resolve.

I haven't seen this in any test because I've never come across that... calling Create<T> twice. In my thousands of tests written with this tool, I've always had only one call to that method per test. But it should work! This test of yours will be great to prevent the regression.

If you are stuck in a bad spot right now, you can downgrade to 1.7.1 or use Moq to create the stub object. I do this occassionally:

var foo = new Mock<IFoo>().Object;

from automoq.

darrencauthon avatar darrencauthon commented on May 21, 2024

@kszepieto I'm still investigating.

It is a matter of calling Resolve twice during a test -- not the SetInstance method. If you use Resolve only to register the class under test, you should be fine.

from automoq.

darrencauthon avatar darrencauthon commented on May 21, 2024

I believe I resolved the issue here:

e7d3977

That fixed the new failing tests. I'm still getting an error around abstract dependency resolution, which I'm still in the process of resolving.

The ultimate fail-safe is to remove the refactorings I made to isolate the "mocking" and "ioc" work. But I really don't want to give them up quite yet -- they're essential to the next place I want to take AutoMoq. Still working...

from automoq.

darrencauthon avatar darrencauthon commented on May 21, 2024

The fix for this has been published as 1.8.1.

Thanks @kszepieto for the catch! It's strange, in all of the years of using this library I've never called Create<T> twice in one test! Your unit tests are part of the test suite to prevent regressions.

from automoq.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.