-
-
Notifications
You must be signed in to change notification settings - Fork 812
Make Moq portable to .NET Core #168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Any news on this? This is something myself and a few others would really like to see. Also happy to help out with any port |
We'd definitely appreciate the help @sblackler! Nobody's working on that port for now. |
At a quick glance, I'm not sure what we can do about Silverlight support currently. Maybe @kuhlenh could provide some insight on what to do/when/if support will be coming? Also, when I import all the files into a new class library project, most of the errors seem to be around the Castle dependency. I think that's going to be the biggest stumbling block for porting. |
Indeed :(. So how about getting Castle to port first somehow? ;) On Mon, May 4, 2015 at 5:34 PM Stuart Blackler [email protected]
|
I've put your report online for future reference. If you reach out to Castle, feel free to direct them my way if they need any help. Otherwise, I'm happy to reach out to them for you! |
Maybe I can just bring @kkozmic to the discussion :) |
and I appear :) |
In previous exploration of what it's like to port existing content to CoreCLR, I have actually already done a private (not ready for PR) port based off of the Moq4 Silverlight 5 version, and would be interested in doing so in a more publicly sharable fashion. Having a usable version of Castle.Core that isn't me hacking around would be great. @kkozmic , can you comment how close to reality this might be? Having already done it, I think the Moq port should be pretty reasonable. |
👍 |
I started experimenting on a port based on the Castle.Core PR by @MattGal (castleproject/Core#92). Update I now have a version at https://github.com/jeremymeng/Moq4/tree/netcore-beta5. It works with Asp.Net vNext. |
@jeremymeng Have you pushed a nuget package for beta5? |
We could. I just replied to the Castle Core thread to see if we can get the code finally merged. That will mitigate the need for a separate package. Also, beta 5 is now a ways out of date. We should be targeting beta 7. |
@richlander Any progress on this, especially now that we're at ASP.Net beta 8 and now feature-complete? |
Hellloooo....? Any news? |
Moq is depending on castleproject/Core#90. Hope we are seeing progress soon on the Castle.Core port. |
Castle.Core support is around the corner so I will submit a PR earlier to get feedback. |
Is there any update on Core CLR support? |
Castle.Core alpha1 package on nuget.org already support .NET Core. I've updated #225 to work with that. Right now everyone is waiting for RC2 release. Once that happens, Castle.Core will be updated to use RC2, and so will Moq. |
I've updated my PR to work with RC2. Moq Team members, please take a look. |
Moq team members any news on this? Thanks :-) |
https://twitter.com/kzu/status/735944176953655296?s=09 On Sun, May 29, 2016, 8:44 AM Luca Briguglia [email protected]
|
thanks @kzu |
@alexellis I suspect that you are missing the
|
(Totally unrelated to Moq though) |
Thanks! I’ve updated my repository by adding some base test classes from Microsoft Identity that I will use later. So far it is building and the 8 added tests from Microsoft that were able to build are testing successfully. From: Jeremy Meng [mailto:[email protected]] https://www.nuget.org/packages/Moq/4.6.36-alpha — |
Thanks I added global.json - I completely missed the fact it was not added. Is there a smart way of restoring so that Docker can cache that step rather than repeating it every single build? |
Hi - I'm seeing random test failures when using This is output from build 186 running this unit test:
And this is from build 189 running another unit test:
Both tests works fine locally on both Mac and Windows, so it could be something to specific to the environment running in AppVeyor. |
Found a missing runtime package dependency in the beta package released on MyGet. System.Diagnostics.TraceSource is needed at runtime but isn't listed in the dependencies for the package. Please let me know if you need any more info on this issue. |
@benrr101 Which version of Moq are you using? There was an issue in Castle.Core but it has been fixed in the latest version. The |
@jeremymeng We're using version moq.netcore 4.4.0-beta8 from myget.org, which has a dependency on Castle.Core >=3.3.4-beta8 (which is the version that got pulled in). Can this dependency get bumped up in the next beta release of moq.netcore? |
@benrr101 Please use the latest version from NuGet: https://www.nuget.org/packages/Moq/4.6.36-alpha. The version you are using is from ASP.NET myget feed, which is pretty old now. |
@jeremymeng you are right! My coworker who suggested using the myget feed version made it seem like this was the only version that worked with .net core. We didn't even think to try the packages on nuget.org. Thanks! |
I'm having no luck creating a project that references Moq and Xunit after following the advice from above. I'm getting the dependency Castle.Core 4.0.0-alpha001 does not support framework .NETCoreApp,Version=v1.0. error Any ideas? { "frameworks": { |
@redowl3 What version of dotnet/nuget.exe are you using? I took your project.json and ran
|
Thanks for the response. I'm using 1.0.0-preview2-003121 and you're correct that does build, but we're trying to test an asp.net app that is using net461 (as we using unported 3rd party libraries) and although the project builds we cannot reference anything from the asp.net project to allow us to test. { "frameworks": { |
@redowl3 could you please share a simple project/git repro that reproduces this issue? |
Hi Jeremy, thanks again for getting back in touch. Not sure how to share a project but I've created an ASP.NET Core Web Application (.Net Framework) and then a Class Library (.Net Core) which has the project.json as above. |
@redowl3 you could publish the simple project to github. |
thank you to Daniel (kzu) for pointing me to this issue. TL:DR (but i hope that you will) Yesterday (2016-09-08) I discovered that the xUnit.net tests for ASP.NET Core 1.0 Identity are successfully using moq.
MORE INFORMATION [A] my current focus is on writing xUnit.net unit and integration tests directly against ASP.NET Core Identity data created via the AccountController the ASP.NET Core 1.0 Web API has generated. ideally i would like to do this without mocking but have hit many roadblocks. [B] https://github.com/gerryLowry/EF_Core_testing_experiments/tree/master/RawCoreAPIxUnit ^^^^ one might find the above code is useful for experimenting. ^^^^ [C] many articles say it is possible to use moq, xUnit.net, and ASP.NET Core 1.0 together. please see issue #284: ideally, for more that just moq, it would be wonderful if one touches one's project.json and need not worry that everything will change state from working code to OMG [D] FWIW, many articles regarding unit testing against the AccountController are somewhat trivial. REFERENCES (expect imperfections): Some to the challenges with unit testing .NET Core 1.0 is the newness of the RTM (2016.06.27). GitHub ASP.NET Core Schedule and Roadmap 2016.06.27 https://blogs.msdn.microsoft.com/dotnet/2016/06/27/announcing-net-core-1-0/ http://stackoverflow.com/questions/29755101/unit-test-identitydbcontext ASP.NET - Writing Clean Code in ASP.NET Core with Dependency Injection Docs » MVC » Controllers » Caution ~~ back up your code before you try this technique MOQ ON .NET CORE |
Hello guys, I have wrote blog post on Moq in Asp.Net core which is as below: https://neelbhatt40.wordpress.com/2016/10/15/moq-in-asp-net-core/ I saw this was hot topic on Stackoverflow so decided to write post on this so that more people can know about this. If anyone wants to give feedback on this then please do and that is the reason I am writing this here. |
No no no you are sending the wrong information. m oq.netcore is obsolete. I don't know why you couldn't find Moqon nuget.org, but it's there Sent from Outlook Mobilehttps://aka.ms/blhgte. From: NeelBhatt [email protected] Hello guys, I have wrote blog post on Moq in Asp.Net core which is as below: I saw this was hot topic on Stackoverflow so decided to write post on this so that more people can know about this. If anyone wants to give feedback on this then please do and that is the reason I am writing this here. You are receiving this because you were mentioned. |
Okay thanks Jeremy, I will update that 👍 |
@jeremymeng Your link is broken, I can only find this on your Blog: Is this one the Blog post? I guess so because I followed it and now I can use NET 1.1 together with Moq |
Yes @raffaeu that link is correct and updated. |
Thanks @NeelBhatt, sorry I though the blog post was from @jeremymeng, I didn't pay attention |
That is fine @raffaeu :) |
Done! |
This is Kasey from the .NET team and we are trying to help authors make their libraries portable across different platforms (especially .NET Core).
.NET Core is a modular implementation of the .NET Framework that can run on any platform (Windows, Mac, Linux). Side-by-side hosting enables apps to run no matter what Framework version the host has installed (if any). Developers include their dependencies (.NET libraries and your libraries) in their app via NuGet packages. .NET Core is a great new option for web and cloud developers and is the same underlying .NET runtime and framework used by ASP.NET 5.
The .NET team has made many .NET Framework libraries available as part of .NET Core and ASP.NET 5. With that work largely done, we need more open source libraries to support .NET Core so that developers can easily both move existing apps and create new apps that run on .NET Core. Our goal is to make app developers successful, building these new apps that target .NET Core and that run on Windows, OS X and Linux.
Check out the .NET Portability Analyzer. This tool gives you a detailed report on how portable your library is across platforms and will sometimes provide recommendations. This is an easy way for you to assess the effort required to support .NET Core and other platforms with Moq.
Please @mention me in this issue to discuss porting Moq to .NET Core. I'm happy to help get you started. If you have broader questions or concerns, you can also file an issue on the dotnet/corefx repo.
Thanks,
Kasey
The text was updated successfully, but these errors were encountered: