Comments (7)
For completeness the interfaces are defined as:
public interface Foo
{
Bar Bar { get; }
}
public interface Bar
{
Baz Baz { get; }
Qux Qux { get; }
}
public interface Qux
{
string Value { get; }
}
public interface Baz
{
string Value { get; }
}
from moq4.
Seems like a valid use case and a bug :(
from moq4.
It gets awkward when you replace bar with
var bar = new BarImpl {
Baz = baz,
Qux = qux
}
If the recursive syntax ends on a mock it should still work.
I've solved my issue by writing a method that takes a Func<T, TMocked>
to get an IMocked, and an Expression<Func<TMocked, TProperty>>
to pass to SetupGet
.
Do you want me to have a look at fixing this?
from moq4.
Would love it if you could give it a shot!
Thanks
/kzu
On Thu, May 15, 2014 at 3:27 PM, James Foster [email protected]:
It gets awkward when you replace bar with
var bar = new BarImpl {
Baz = baz,
Qux = qux
}If the recursive syntax ends on a mock it should still work.
I've solved my issue by writing a method that takes a Func<T, TMocked> to
get an IMocked, and an Expression<Func<TMocked, TProperty>> to pass to
SetupGet.Do you want me to have a look at fixing this?
Reply to this email directly or view it on GitHubhttps://github.com//issues/110#issuecomment-43246948
.
from moq4.
Cool. I'll check it out. I came across the relevant areas of the code when making my last pull request. Shouldn't be too difficult. (He says)
from moq4.
Closing this, this problem will be tracked in #643 (together with a couple other related issues).
from moq4.
After the recent merges, this might finally be fairly easy to fix.
from moq4.
Related Issues (20)
- Moq library throwing TypeIniatilizationException. HOT 1
- Request: Ability to setup a property of type Task<ConcreteType> by mocking interface
- Supporting .NET8 HOT 2
- Mock.Protected().Verify fails sometimes
- Moq "set" matcher fails when setting StringValues with string HOT 1
- It.IsAny<StructObject>() isn't
- Documentation Unavailable Online HOT 2
- Consider adding IgnoresAccessChecksTo("Unsupported")
- Explicit support for matching cancellation tokens with It class. (It.IsCancellationToken())
- Moq Setup does not work with "object" as generic type? HOT 1
- IVerifies.Verifiable* documentation comments errata?
- Support for post-invocation callbacks on void methods?
- Semantic error in unit test MatchesIsNotInEnumerable()?
- Documentation link is broken HOT 9
- Constructing Mock<DerivedControl>.Object throws TypeLoadException HOT 2
- How do you Verify an IAsyncEnumerable<T> ?
- Add Way to Exclude Calls from VerifyNoOtherCalls HOT 1
- mock.Protected().Verify() does not work correctly HOT 2
- Constructor arguments should be nullable
- Documentation link gives 404 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 moq4.