Rhino mock vs Typemock vs JustMock vs [closed] - moq

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I need to choose mock framework to new project.
What are the pros and cons for those frameworks?
Any comparison table?
I know that JustMock is i beta stage but it's look very good right now (very similar to TypeMock)
Edit: I'v What about MS Mole?

Before there was JustMock this question was asked and the answers can be found here.
There is a very good Mocking framework comparison - it doesn't have JustMock yet but you get to see the syntax and capabilities of each .NET mocking framework.
RhinoMocks (and Moq) are both open source free to use projects that can create fake objects by inheriting the type - which means that they can not fake static methods, structs and sealed classes.
Typemock Isolator uses the CLR profiler to intercept .NET calls and change them during runtime and can fake virtually anything. Typemock can also fake objects that you cannot "reach" from the test because they are instantiated inside the production code.
Some call it "black magic" but others find the ability to fake virtually anything - including 3rd party libraries and legacy code - a must.
JustMock is a new player and right now only in Beta - it has some of Typemock Isolator and can run without the profiler API - in this mode it's just like RhinoMocks.
It is yet to be discovered how much of Typemock Isolator capabilities does it really have. Right now it seems that its a good start in the right direction but it still have some distance to go before it could be a valid option.

I recently switched from RhinoMocks to Moq.
Both have similar capabilities but Moq has much cleaner API

[Disclaimer - I work at Telerik]
Just a few points about JustMock. Its API is more similar to Moq's API than RhinoMocks', so if you’re familiar with Moq you shouldn’t have problems learning JustMock.
What we've tried to do better in JustMock is to have a better story when mocking sequential calls for example.
Additionally as someone already mentioned JustMock makes it possible to mock static classes and methods / properties, sealed classes, non-virtual methods and properties and so on using the same Moq-like syntax.
Also thanks to this in JustMock it’s possible to do partial mocking.
Btw, the "black magic" that Dror mentioned is also possible when using JustMock if you reference directly the Telerik.CodeWeaver.Hook assembly but unfortunately that's not documented at the moment.
Should someone want to do that, he could open a support ticket and we'll be glad to help.
Hope this helps.

Also checkout Microsoft Moles, an isolation framework for .NET that allows to replace any .NET method with a custom delegate.
Moles has a version that can be used for commercial projects and is supported in Visual Studio 2008 and 2010.

Also see: https://stackoverflow.com/questions/37359/what-c-mocking-framework-to-use/2608634#2608634
I'm currently Unit Testing in Moq, and I must say it works pretty well! - rephrase: It works great! I've not used any of the other mocking frameworks you mention so I can't give you a comparison. But I can say that I'm glad that I've chosen Moq as my first-to-try mocking framework. The lamda expressions are really nice and it's also pretty lightweight and reader friendly (the record/replay syntax in most other mocking frameworks aren't really doing your readability any good)
Besides that (and this is a bit off-topic) I will be using Ninject in the near future as IoC Container, and both frameworks go hand-in-hand. Ninject also has Lamda's and it even provides auto-mocking container support for Moq (using an extension). So if you're also planning to use an IoC container you could check this awesome combination :]

I won't tell you which is the best becasue each has its pros and cons. I always used Rhino Mocks because it's free and there is a great community around and easy to find any help.
TypeMock is not free (I guess). However TypeMock is great if you want for example to test the legacy code with private or static types an members. Other mocking frameworks can't do it. A drawback is that it doesn't force you to write testable code which has other benefits that just the testability.
I don't know JustMock so can't tell you how it works.
I would advice you to try them all and to pick un one with which you feel comfortable. However if you need to test legacy code, chose than TypeMock.
I hope others will give you more details.

Related

Choose framework [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Im thinking about starting a website project with a framework that will be also a study project for me. To be more exact a biologist kinda site with quite some filters and there is the question also if I should use separate database or flat file for 8 translations for the different species names (the site also has to be international, but just with 3-4 languages). Im thinking hard about which road to take... so I am asking for some constructive inputs please!
Im thinking of yii because of its simplicity, I tried it and it seems to be working smoothly.
Im thinking of symfony2 because it seems to be more advanced and some great websites were built with it, also drupal8 was constructed with it if Im not mistaken... and even if its harder to get going with it if its worth the effort I would do it.
Im thinking of spark, a java mini framework or Eclipse Link as later I plan to make an offline version of this webpage and I hope its not that hard to port it as a standalone java app. But I'm novice in java and hate the java documentations filled with acronyms all the time and supposing that I know those essential steps that are considered to be self evident by experienced java programmers.
I think there is no correct answer to your question. Chosing a framework is a matter of philosophy, and personal preferences. Some people will think that Yii is easier to use and some other will be amazed by symfony capabilities.
If you know a framework, I'll advise you to stick to this one and if you don't check out the basis of each ones and choose the one that seems to fit your need the most.
But at the end if you choose a popular framework (Yii, Symfony, Laravel, ...) you'll be able to achieve your goal.
Personally I like Yii, having never used the others :) For this exact reason I've flagged to close this as not constructive. There is no correct answer to this question.
I would start up a project in each, try and accomplish some common tasks, then decide. Ultimately you'll be able to acheive everything in all those frameworks. The deciding factor will be how fast and how comfortably you can use the frameworks, not how everyone else uses them.
Yii supports multiple databases very easy; Think about this;
All you have to do is create the database and the rest is, easy ...
Just create a simple blog app, and see wich one is the easyest and fastest when developing.

MVC Testing in VS 2010 vs VS 11

Over the last 2 months, I've been trying to learn the new MVC framework. After getting my head around all the object oriented concepts, I created a test site using MVC3, EF4 w/ DbContext, and ASP.Net Membership provider. All was going pretty well. Then, I decided to dive in and learn testing, starting with Unit Testing.
After 2 weeks of banging my head against my keyboard, I now feel as frustrated as can be. I've gone through tons of video tutorials (TekPub, Plural-sight), online tutorials (ASP.Net, Microsoft, etc..etc..) and plenty of StackOverflow questions/answers. I now sort-of (ha!) understand Loose Coupling, Dependency Injection, Respositories, Interfaces, Stubs, Mocks (yes, I read the Fowler article many times), Shims, lambdas, refactoring...the list goes on and on (...and on.). I've looked at Ninject, Structuremap, Moq, TypeMock, JustMock, nUnit, xUnit, etc...
So I know there are a bunch of ways to skin this cat. Now I see that VS11/MVC4 is coming out and they have this thing called Fakes which seem to be a good option for static methods like the Membership stuff.
My question:
I want to test my MVC EF4/DbContext/Membership application. Most of my pages require an authenticated user [Authorize] and thats before I even get to the actual method to be tested.
If you were just starting out (like me), what is the simplest and easiest route to testing my CRUD application? I don't necessarily like having a DI framework running on the production side (just another thing that might go wrong) and I find the fracking things are confusing as all get out.
I could upgrade to VS11/MVC4 and try the Fakes approach. Appears to be slightly simpler but still seems like I need all the Respository/Interfaces for EF stuff.
Or would you just chuck it and use an Integration Test tool like Selenium (which is what I had to use before with Forms based development)?
Any suggestions are greatly appreciated. Sorry if this is a lousy question but I'm hoping for a ray of light here...
For all versions of mvc or programs its almost same way of testing.
You sould have most of your logic based on interfaces.
this will allow you to separate concerns and unit test anything you need also this will give you posiibility to fake (create fake implementations) or mock (create class on runtime that will represent logic you want, using Mock, or Rhino Mock) the logic.
You can read more about basic unit testing here:
http://msdn.microsoft.com/en-us/magazine/dd942838.aspx
also i would recomend you have a look on book where Steven Sanderson has example application including unit testing of most parts.
http://www.amazon.co.uk/Pro-ASP-NET-MVC-Framework-ebook/dp/B005PZ07US
Here you have introduction to MOQ
http://www.codeproject.com/Tips/182847/An-Introduction-to-MOQ
You have alternative such as rhino mock:
http://ayende.com/blog
and some examples:
http://daysincode.blogspot.com/2012/06/examples-of-mocking-with-rhino-moq.html
Of course everything here leads to : http://msdn.microsoft.com/en-us/magazine/ekstremalna-przerobka-asp-net--czesc6-podzial-obowiazkow.aspx

Suggestions for ASP.NET Website [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I am working on big application build using ASP.NET which was started 1.5 years back. The Site uses 3rd party telerik RadControls for UI. The problem with the website is it uses outdated stuffs like DataSets and all with no proper architecture. I have done some research and found some new technologies like ADO.NET Entity Framework out here. I want to know that is it worth investing to learn and migrate my site to ADO.NET Entity Framework at this stage.
Additionally are there any good technologies or tools (that can be used in ASP.NET) out there in the market which can be used to make the development life easier and be upto date with latest technologies.
ALL SUGGESTIONS WOULD BE REALLY PRECIOUS.
THANKS IN ADVANCE.
There is no real answer to this question.
Entity Framework is very useful. As is ASP.NET MVC. I guess it depends on what your metrics are to determine if it is worth it.
What are the goals for migration? Are you looking for a more testable website? Its unlikely to be worth migrating a large website just for the sake of it, so determining the measure of a successful migration may naturally lead you to a decision.
Its also worth noting that ASP.NET Web forms are still a viable option. If you want rapid development, which uses data grids and such like, then forms might be your best option. You could look to move to MVC, which will allow you to enforce a cleaner separation of concerns. Its horses for courses. A quick Google and you will find plenty of forms vs mvc pros and cons.
You could also consider a piece meal migration. For example, you could build and Entity Framework model of your database and start to use it one page at a time. Slowly removing ADO, but maintaining a working site. You can also use Forms, and MVC together in one site. So you don't have to do a complete migration in one go.
Food for thought, good luck.
The problem with questions like this is that the answer is always "it depends" however, having recently done some work with Entity Framework and MVC3 I will say that it is a very good platform to work with- MVC3 is logical and easy to work with and EF does a bunch of lifting for you.
Ultimately it depends how far along the project is and how much of it is complete in the way that it currently works. For example, if you have a decently designed database and a bunch of half finished pages then making the switch is probably not going to be a lot harder than finishing up with what you have, but don't underestimate the sheer scale of a rewrite when combined with the need to learn to use several new technologies even if the technologies themselves are fairly quick to learn. On any project of significant size you will run into quirks of the platform you are working with and find yourself completely stumped at least a few times.
On the other hand, the idea that something being outdated is a reason to replace working code is one that tends to result in expensive, embarassing project overruns. If it's most of the way finished and you are just lined up to do finishing touches then make the best of what you have and remember that Shipping Is A Feature. Similarly the size of the project and how business critical it is have a big impact. If this is a minor internal project maybe you have more room for a rewrite, if it is responsible for the company's revenue stream you need to get this version out fast and then think about refactoring later.
Either way, you need to talk this over with other stakeholders before throwing yourself into a potentially high-risk endeavour.
I have generally used Obout controls as a third party toolkit. I wish I could help more about switching to ADO.
Although, I don't suppose learning it would hurt, even if you don't end up using it for this particular project.
Good luck!
It all depends... Can you afford to migrate? Is your current framework not what you need it to be?
If you want to throw away 1.5 years of development just because something new has been released, maybe you should think twice. You surely know there's another version of .NET framework coming and who knows what will it bring? Does it mean that you will migrate again next year or so?
However, if you have designed your website the way it can be easily done, by all means, switch to new technologies and migrate how much you want and how you feel comfortable.
Whether or not it is worth converting your application to EF is a decision only you can make. You know the existing code base better than any of us. Evaluate how much code you would need to change, how much time you have, how much re-testing you would need to do, and so on. Depending on what you find, that will tell you whether you should upgrade or not.
I would love to upgrade every asp.net 2.0 app I find to MVC3 with EF, but usually time and resources only permit that we fix what is broken and move on the next project.
That said, EF is a wonderful advancement in data access. If it isn't worth doing on this project, it is definitely worth learning for the next one.

ASP.NET Code Generator [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I have a SQL Server Database. I would really like to quickly generate a middle-tier and a front-end from this database. I would prefer something that generates web forms if possible. I understand that no code-generator will be phenomenal. However, I just want something to get me up and running quickly that I can then customize as needed.
Can anybody recommend any code-generators?
Thank you!
There is ASP.NET Dynamic Data. If you can live with MVC, EF4 and MVC3 would be my choice above Dynamic Data.
I have a friend who is releasing a code generator very soon. You provide xslts based on the data model to create classes at any layer you want. Here is the site: Code Generator
Be sure to check out the sample project.
I have successfully used Code Smith (commercial product).
It is a popular templating engine and you will find many templates on the Internet for all kinds of architecture / data access frameworks.
I have also used plain T4 templates that you can use within Visual Studio without having to install anything (although I would recommend using something like Tangible T4 Editor to get color syntax).
If you have Visual Studio (2005 or greater) you might consider T4 templates. There's a good introductory video at DNRTV. T4 is a little known code generation facility that comes with all editions of Visual Studio (even Express I believe).
On some of my projects I have used MyGeneration, a free and open source code generator. This is also a good option.
You can use Entity Framework to generate objects from database schema, and then use the MVC Framework to generate stronly-typed views that use the said generated objects as models.
Here's a good post on that - http://weblogs.asp.net/scottgu/archive/2010/07/16/code-first-development-with-entity-framework-4.aspx
I'd give SubSonic a try, especially the ActiveRecord version. It basically will generate an interface(with Linq) to an existing SQL Server database, For taking it to forms, I suspect you won't find a very good solution because there are so many implementation details that are commonly placed in webforms, such as XSS prevention, how things should look and behave, etc.
I suggest a tool that I have use for really rapid application development, is the asp.net maker. http://www.hkvstore.com/aspnetmaker/
I have used it for low budget projects, or where I need for a dirty quick solution, until the final gets ready. What I have did is that I create solution for the easy tables, and make code for the one that need too many thinks to be fix.
The pros is that have many future, its very easy and you do not need to know almost anything to make the interface, create from the database, all the environment that can edit it, have the opportunity to make a lot of adjustments, and what you get is a better page than the Scaffold can product.
The negative is that you stick with what this tool product, and you can not update the pages by your self to make some small changes, because is too complicates one, second if anything change, the pages changes, and even if you rename it and not overwrite it, it maybe not working.
You need to test it and see by your self.
Redbrook Technology has a great ASP.NET forms and code generator. It's also very cheap. Give it a try - ASP.NET Generator

Design and Modelling for DexExpress eXpressApp Framework

The DevExpress XAF does much basis work for you, it creates a database based on your business objects, and dynamically generates a UI based on these, with basic functions like add, delete, sort etc. already present.
This leaves me wondering how to go about properly designing and modelling an application built on this framework. I could only model my business objects, or I could identify functions provided by the framework and include them in a details model down to sequence diagram level, but so much is being done by 'external' calls that I feel I would be wasting valuable time.
I am hoping someone with experience modelling application designs for this specific framework can give me some advice on what areas I should focus on.
As for DC, as Leon mentioned above, it has many benefits compared to the regular persistent classes. If all goes according to plan, we will release the Domain Components technology in the near future, and resolve all the remaining issues with it.
If you feel that it is hard to learn, please let us know the most difficult parts you experienced. We will be glad to review them and possibly make the things easier for you and other users.
P.S.
I apologize for the delay in responding; I was on sick leave. You will receive more timely responses if you post your questions in the DevExpress Support Center.
#ProfK:
Am I correct that you are looking for something like visual designer for your business models?
If so, then I am afraid that XPO (XAF) does not currently provide such a functionality. However, you can use free third-party tools for modeling, such as Liekhus ADO.NET Entity Data Model XAF Extensions
I hope you find this information helpful.
I'm using XAF for almost two years now and I'm very happy with it. Developing an app is very quick, nice architecture, both Win and Web the same time and great UI. As with all frameworks, it has a learning curve, but if your already familiar with DevExpress controls that it's not very hard.
As Dennis mentioned, most behaviour can be overriden or extended. Regarding your modelling question, if think an important choice you have to make is whether or not you will use their Domain Components technology. Basically they have 2 ways: the old fashion way by inheriting from the XAF or XPO base classes or by using DC. DC allows a clean separation in modules and allows multiple inheritance. They can do that by generating classes runtime, but it still has some issues.
And the framework comes with a Business Class Library, a set of common classes which may be useful.
When I get stuck or cannot find the answer myself, I always use their fantastic Support Center. Most issues I ran into were already asked and answer on that site.
Briefly, each XAF application consists of Modules. There can be standard (system) and extra (user-defined) modules. Each Module can contain business objects, so-called Application Model customizations, Editors, Controllers, and Actions to provide additional business logic, customize UI and provide interaction between framework parts. You can model and customize your application on each level listed above, including but not limited by the underlying framework's metadata and data store ones. You can find more information about the framework's architecture here:
http://documentation.devexpress.com/#Xaf/CustomDocument2559
I should emphasize that it is possible to override behavior of almost every part of the framework. For instance, create your own editors for detail and list forms, override certain standard controllers, etc.
If you experience any further difficulties with our framework, feel free to contact us through our Support Center. We will be always glad to not only answer you questions, but advice a certain technical or design solution, provide some example code, etc.

Resources