Comments (5)
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.
@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.
@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.
I believe I resolved the issue here:
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.
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)
- Auto-mocking abstract classes throws ResolutionFailedException HOT 5
- Generated mock is not able to be called twice HOT 4
- Auto-mocking an interface throws System.InvalidOperationException HOT 2
- Provide concrete base types to mocker HOT 1
- Strong name the assembly HOT 5
- Unable to specify constructor for AutoMoqTestFixture HOT 2
- Include Comments in next Release HOT 3
- Allow mock behavior to be changed. HOT 2
- Expose access to SetInstance in AutoMoqTestFixture HOT 5
- do automatically setup for methods HOT 2
- Upgrade Unity? HOT 9
- Cannot SetInstance different objects implementing same interface HOT 8
- Is AutoMoq should work with asp.net core? HOT 25
- Replace Unity with Autofac? HOT 3
- AutoMoq not working anymore with registered type in container
- Support Unity >= 5.x HOT 1
- Can't create a loose mock when default behavior is strict HOT 1
- AutoMoq throws NU1602 Warning in VS2019 HOT 1
- Dead? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from automoq.