Is there any documentation or example how to use MvcContrib.TestHelper.Ui and WatinDriver?
I haven't found any real documentation for it, but there are examples of its use in the source code for the CodeCampServer project.
You might also want to take a look at Chapter 20 "Full System Testing" in the book "ASP.Net MVC 2 in Action."
It's a really great look at a similar approach to what the WatinDriver is trying to accomplish.
Its discussion is also great in terms of designing your UI/HTML to be testable with tools like WatiN, and techniques to help make your browser testing less brittle.
EDIT: The WatiNDriver in use in the Code Camp Project source code isn't technically the one from MvcContrib.TestHelper, but I'd be surprised if it differs by more than 2 lines of code. Basically it looks like they borrowed the code directly from MvcContrib and added some of their own stuff on top of it.
The code in codecampserver is the test bed we used to create the MvcContrib source code. We have recently brought on a new committer to the MvcContrib project that is going to focus on this area of the codebase. Also, you are right on about the Mvc2 in Action book. We really followed that approach that is outlined in the book. Also, feel free to email the mvccontrib email list.. We do reply to that list, we do not follow the SO questions as much so keep that in mind.
Related
I'm developing a site in umbraco, and integrating uBlogsy (blog) in it.
But the problem is, uBlogsy offers its own look n feel. However i want to have my existing website design in Blogging part as well.
here is the link for the same :
http://our.umbraco.org/projects/starter-kits/ublogsy
I've done that manually. but its a time taking process.
Does any one knows, how can i do that? is there any automation available for the same?
Or if there exists any better blog than uBlogsy offering same feature and functionality?
Thanks in advance.
uBlogsy is the de-facto blog package for umbraco so i'd be surprised if you find anything better (the community is encouraged to build upon the best instead of spin up many sub-par competitors, but i digress).
I've done that manually. but its a time taking process.
^^This sounds like you have modified the cshtml markup and css from the package. This is indeed the way to go.
There isn't really any plug-in theming that i'm aware of and it sounds like this is what you're looking for, right?
I've used uBlogsy many times on past projects and usually don't keep anthonys files for template views but rather start with fresh markup to match my wire-comps. Since his files are included - they make a great example for how-to access the data.
Sorry it's probably not what you're looking to hear. But i think it ultimately gives greater control and better result to get hands-on.
I am an MVC developer since ASP.NET MVC Preview 1 and my company chose me as an instructor for an MVC 2 workshop. The session will last for 3 hours and I have not yet decided about the contents of the workshop.
What would you tell about MVC 2 in 3 hours to grab and keep the people's attention?
Thanks.
You should watch some of the presentations on Channel 9. And pick some topics that they go over...
Basics
NerdDinner
It will depend of the kind of people will watch your workshop, it they are familiar with ASP.NET, ASP.NET MVC or the MVC pattern, etc.
I think that the first and bigger concept behind the MVC is the separation of concerns, and you should show it and how it can help the developers, specially with the TESTING issue.
If people are not familiar with MVC, only this part would take a good time. If they're familiar and you want to talk specifically about the version 2 of the framework, I think the bigger changes from the previous one were:
Areas
Template Helpers
DataAnnotation Attributes
Model validator
With few examples, once 3 hours is few time to get deeper in each of these points. Would be nice to develop a few app live so they can see how easy it is.
after introduction of mvc framework u can go on to include following topics
Routing (route constraints matching and custom route handlers)
Model validation and custom
validation attributes Security and authorization attributes Model
binding default model binders and writing custom model binders
custom html helpers
Take a look at 13 extensibility points of mvc
Read Steven Sanderson's book, especially the bit about glib demos that don't tell the real story.
Some people suggest Nerddinner, but why not just point them at Hansellmann's video on the subject? To be honest, you need Nerddinner to get an impression of how MVC works, and Steven Sanderson's book to get an impression of how to use MVC.
Still, I really don't think that this is a valid question, and don't know why the Stackoverflow police have not jumped on this one.
Check out some of the presentations here: http://www.asp.net/mvc
Scott Hanselman has a 73 minute one on the home page, that might be a good one to start with and mimic, as well as some of the other ones.
Why not take them through building NerdDinner? http://www.wrox.com/WileyCDA/Section/id-321793.html
Some of the Scott Hanselman videos out there on MVC are good, too, and might give you a small break from talking.
One thing I would cover is the flexibility of MVC. E.g., you have your choice of models and view languages. I would definitely cover the Spark View Engine, to give people an idea of how they can get away from code-centric (as opposed to markup-centric) view languages.
I would like to download ASP.NET MVC web site template. Please guide me where can i find and how i can use. I'm new to this pattern. Thanks in advance.
You can try starting at http://msdn.microsoft.com/en-us/library/dd410597.aspx
it already starts with a little code and design to show you the basics then walks you through a few more things like how controllers work, how a model can be used to simplify dealing with posted values and common content etc.
Here you go!
http://mvccontribgallery.codeplex.com/ - design templates
http://www.asp.net/mvc - look # the sample application section (open source, good tutorials included)
Guys from http://pixelsinspired.com are starting something you may be interested in. There is only one template, but it is free and looks great.
I am trying to learn Asp.net Mvc so I am trying out
this Tutorial.
They talk about the Repository Pattern and how it is easy to change to another data access technology instead of just calling Linq to Sql directly.
Using LINQ to SQL within a controller class makes it difficult to switch data access technologies in the future. For example, you might decide to switch from using Microsoft LINQ to SQL to using the Microsoft Entity Framework as your data access technology. In that case, you would need to rewrite every controller that accesses the database within your application.
Note: I never really understood how an interface worked before reading this tutorial and it's still not 100% clear. I see it now as some sort of 'template' for a class.
After successfully using Linq to Sql I thought it would be nice to try out Ado.net Entity Framework since I've been reading a lot about this. They said using the Repository Pattern would make it easy to switch so I thought I would test that.
My question is: what should I do to change to Ado.net EF?
This is what I think I should do.
Add the Movie.edmx file and configure it(add my movie table).
Write a new class based on the IMovieRepository and maybe call it MovieEFRepository.
Change the parameter in the controller constructor to MovieEFRepository. This is the first thing I find strange because in the tutorial they say that not using the repository will force you to change all the controllers if you change to an other datasource. Don't I need to change every controller anyway since I am specifying the MovieRepository class?
The last adjustment I think I need to do is to change the View. Because it's using the Product class which was created by the Linq to Sql designer. I am not sure how I am going to do this. I guess I should have used some object that wasn't dependent on the dbml file?
Forgive me if I have a slightly simplistic view of Asp.net Mvc. I am webdesigner with a lot of interest for Asp.net webdevelopment.
So after a few days of reading and a lot of googling I got it to work. First I tried to find out what IoC (Inversion of Control) actually meant.
One of the first sites I found was a website with a screencast about Unity. Which is a DI/IoC framework for .Net.
Link: David Hayden screencast on Unity.
Looking at it now this is actually a very good screencast and example on how easy it is to use Unity and IoC/DI. At the time I didn't understand it completely so I went on and kept googling.
One website I kept running into was the one from Martin Fowler.
Link: Martin Fowler - IoC Container and the DI pattern
For me, a person that is a coding novice this website is a little to abstract. Also this might sound weird but the font, line-height and typography on that website was really awful which made it even harder to read.
The next website I read was about Windsor Castle since Alfredo Fernández said it was easy to use.
Link: Castle Project- Windsor Container
The documentation wasn't to bad but I had some problems converting their "getting started" basic example to my Asp.net Mvc application. Also part 2 and 3 were missing from their getting started.
After this I started looking for the different frameworks to see if i could find a really basic example. If I just looked at the first screencast again I would have fixed it a lot sooner but somehow I lost track of it.
Link: Scott Hanselman: List of .NET DI Containers(IOC): very good blog post with most of the .NET IOC solutions.
Link: Phil Haack: TTD and DI using Structure Map: Using the xml configuration file was to complicated for me and i couldn't get it to work.
Link:
Andre Loker: ASPNET-MVC-with-Windsor-programmatic-controller-registration: Didn't try this example. Looking at it now I might have been able to get it to work.
Link: MvcContrib: This adds functionality to Asp.net Mvc. It also has 3 or 4 IOC ControllerFactories build in. I couldn't get it to work I also didn't find a lot of documentation about this.
I had a lot of problems with xml configuration files and I couldn't seem to get them to work. I tried Windsor, Structure Map and Spring.net but I always got stuck with the xml files.
So I decided to go to the Asp.net Mvc site because that's where I started learning about Asp.net Mvc. I found the first screencasts and MIX09 presentations very clear and I understood most of what people were talking about. I got stuck at the second screencast by Rob Conery when building the Storefront application. Because I knew a little more about repository and IOC/DI now I thought it would a be a good idea to start watching Rob Conery's screencasts again. In one of the screencasts he talks about uploading all the samples to codeplex.
Link: Codeplex: Mvc sample apps
I went to codeplex and found out you can browse through the source files without downloading them. I tried to find out how Rob Conery handles IOC/DI with his repositories. So I was glad to see he was using Structure Map but instead of using a xml configuration file he was using a bootstrapper class that registers all the interfaces to their concrete class.
After trying this with my webapplication I finaly was able to get Structure Map to work in my application (Hooray).
He also showed me how to fix the dependency on my Product class that comes from Linq to Sql. He creates an extra object that then gets called by "select new product { }" in the Linq queries.
Wow, this answer is a little longer than I planned but I hope this helps other people like me who are very novice in coding and Asp.net Mvc.
You might have your repository decoupled because of injection, not if you followed just the examples because of
public MoviesController() : this(new **MovieRepository**())
I recomend you to read about IOC, is easy and very interesting, you can use and ioc container like castle windsor.
With that, your contoller will have only one constructor, the one with the interface, and not will need to be changed.
With your entities you can do the same that with the controllers, create an interface for each entity and use the ioc pattern too, with tha you will only have to change your configuration file for your ioc container.
If you don't do these things, your right, you will need to change all you said.
I hope that help! sorry about my english!
Maybe I live in a bubble, or am just too new, but I was wondering if anyone else has noticed the heavy use of 'var' to declare variables instead of a specific type in many of the MVC examples by Microsoft? Is there a purpose for this, or is it the "in" thing to do now, or just personal style?
Jared Parsons talked about this in his blog I don't agree with his conclusions (as my comment there indicates), but this article should explain why it's used so much.
All MVC Videos are maded in speedy way(also not always they using Unit test or placing bussiness logic in controlers). This is not because they are bad programmers, or "var" is cool, but because they want to quickly show some cool new features, and typing full name twice is not what they want to show.
The answer I gave below (in italics) is incorrect but as I would assume it is an assumption that a lot of people will make I am leaving it in.
For a explanation on why it is wrong read:
Var is Not Object
WRONG ANSWER: Personally I think that var has a bad name due to it's poor use in languages like Visual Basic and Excel Basic.
At the end of the day everything in .NET is derived from object which is basically the same as declaring something as var.
All of the above.