Git Product home page Git Product logo

Comments (15)

stakx avatar stakx commented on August 23, 2024 1

Also, stay tuned for Moq 5, which also performs compile-time code generation instead of runtime dynamic proxying.

from moq.

kzu avatar kzu commented on August 23, 2024

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.

JamWils avatar JamWils commented on August 23, 2024

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.

kzu avatar kzu commented on August 23, 2024

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,
James

Reply to this email directly or view it on GitHubhttps://github.com//issues/102#issuecomment-43359496
.

from moq.

JamWils avatar JamWils commented on August 23, 2024

Thanks,

I'll start looking around and playing with it and get back to you.

from moq.

machadogj avatar machadogj commented on August 23, 2024

Hi @JamWils, have you guys made a decision yet?

from moq.

JamWils avatar JamWils commented on August 23, 2024

@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.

jamesathey avatar jamesathey commented on August 23, 2024

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.

jonorossi avatar jonorossi commented on August 23, 2024

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.

jamesathey avatar jamesathey commented on August 23, 2024

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.

kzu avatar kzu commented on August 23, 2024

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.

stakx avatar stakx commented on August 23, 2024

@jamesathey, @JamWils, I would like to close this issue for two reasons:

  1. 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?

  2. 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.

karlingen avatar karlingen commented on August 23, 2024

Here's an alternative that should work on Xamarin.iOS, Xamarin.Android, Xamarin.UWP https://github.com/kentcb/PCLMock

from moq.

karlingen avatar karlingen commented on August 23, 2024

@stakx Where can I subscribe to Moq 5 updates? :)

from moq.

stakx avatar stakx commented on August 23, 2024

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)

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.