Comments (15)
Also, stay tuned for Moq 5, which also performs compile-time code generation instead of runtime dynamic proxying.
from moq.
I'm not sure those platforms support Reflection.Emit, required to generate
the dynamic proxies at run-time.
I'm pretty sure it won't be feasible in iOS, may work on Android though.
I'd first try to port Castle DynamicProxy, as that would be the major
milestone first.
Thanks!
/kzu
Daniel Cazzulino
On Fri, Mar 21, 2014 at 4:57 PM, JamWils [email protected] wrote:
I've tried using Moq for unit testing on these platforms and seem unable
to do so. Has anyone checked whether this is feasible or not? I think
trying to move this to a PCL would help with this matter. I can look into
it myself if that is fine? I'm new to helping out with an open source
project. I love using moq for testing and would like to use it on those
platforms.Reply to this email directly or view it on GitHubhttps://github.com//issues/102
.
from moq.
Hi kzu,
Sorry it took me so long to get back to you. I was pulled off Xamarin for a while and now I am back on it. I will look into the Castle DynamicProxy. I believe that Android support Reflection.Emit, but Xamarin.iOS definitely does not.
I'll get back to you on how I do with Castle DynamicProxy.
Thanks,
James
from moq.
We had someone at Xamarin hack it to run on iOS but it will only ever work
on the simulator, not an actual device.
The only way I see this moving forward, is if we move to compile-time
generated proxies, by analyzing the test assembly code (Cecil or whatever),
and generating a [YourAssembly].Proxies.dll that Moq dynamically tries to
find at runtime. If it doesn't (i.e. that would be the case for
non-msbuild-generated proxies (desktop apps), then it would try to
dynamically generate them.
Or we can just say that we don't do anymore dynamic codegen and just fail
at runtime...
/kzu
On Fri, May 16, 2014 at 2:45 PM, JamWils [email protected] wrote:
Hi kzu,
Sorry it took me so long to get back to you. I was pulled off Xamarin for
a while and now I am back on it. I will look into the Castle DynamicProxy.
I believe that Android support Reflection.Emit, but Xamarin.iOS definitely
does not.I'll get back to you on how I do with Castle DynamicProxy.
Thanks,
JamesReply to this email directly or view it on GitHubhttps://github.com//issues/102#issuecomment-43359496
.
from moq.
Thanks,
I'll start looking around and playing with it and get back to you.
from moq.
Hi @JamWils, have you guys made a decision yet?
from moq.
@machadogj, unfortunately, I just don't have the time to look into this like I was hoping too. If I ever get the chance I will let you know. It would be great to have moq running on the clients of both iOS and Android. I am spending most of my time on iOS Swift these days. Thanks!
from moq.
I've made a lot of progress toward a working Xamarin.Android port of Castle.Core. I've submitted the first pull request, but there will need to be two or three more after that before the work is fully upstreamed.
If moq on Xamarin.Android matters to you as well, let @jonorossi know.
from moq.
There shouldn't be a need to use Cecil or something else as DynamicProxy on the .NET Framework allows you to persist the dynamic assembly it creates to disk. I recall some people doing this to run NHibernate with proxy support under medium trust deployments many years ago. Take a look at the unit tests (in the base class) and you'll see just about every unit test also does this to run peverify after generating code. This might be a solution for iOS.
from moq.
FYI, I have completed my moq4 port to Xamarin.Android. It passes all of the unit tests using my android branch of Castle. Once that android branch is merged into Castle, I will submit a pull request here for the changes to Moq.
from moq.
Sounds great!
On Wed, Jan 13, 2016 at 1:32 PM jamesathey [email protected] wrote:
FYI, I have completed my moq4 port to Xamarin.Android
https://github.com/jamesathey/moq4/tree/android. It passes all of the
unit tests using my android branch of Castle. Once that android branch is
merged into Castle, I will submit a pull request here for the changes to
Moq.—
Reply to this email directly or view it on GitHub
#102 (comment).
from moq.
@jamesathey, @JamWils, I would like to close this issue for two reasons:
-
I think it would be better to track support for Xamarin.iOS and Xamarin.Android separately. Judging from the above information, these two platforms have rather different support for dynamic type generation, and making Moq work on them will likely involve finding different solutions for each.
May I suggest that, if you are still interested in support for those targets, you re-open a separate issue per specific target?
-
It seems that work on this has slowed, or even stalled; both here at the Moq repository, and over at Castle.Core's.
@jamesathey, you appear to have been successful of getting Castle.Core to run on Xamarin.Android. If I interpret castleproject/Core#135 correctly, it took some modifications based on Castle's .NET Standard 1.3 target? Are you still planning to send PRs towards Castle.Core to get them to support the Xamarin.Android target directly? That would probably be a precondition before more work can be done on Moq.
from moq.
Here's an alternative that should work on Xamarin.iOS, Xamarin.Android, Xamarin.UWP https://github.com/kentcb/PCLMock
from moq.
@stakx Where can I subscribe to Moq 5 updates? :)
from moq.
Subscribe to the https://github.com/moq/moq repo where v5 is being developed. You can also join Moq's Gitter chat at https://gitter.im/moq/moq.
from moq.
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 moq.