Creating Tests after creating view presenter?

Topics: Web Client Software Factory, Project Management Forum, UIP Application Block discussion, User Forum
Oct 19, 2007 at 12:43 PM
I have a simple question that I hope the team can answer quickly.

I have a project that has about 150 view presenters created. It was incorrectly created without the test project/harness. Can I rerun the guidance and create a view presenter with tests and not lose any current information in the view presenters that are already created? If not, is there a work around?

Thanks.
Pat.
Coordinator
Oct 19, 2007 at 5:35 PM
Unfortunately, this will not work. You could probably write a quick script (in PowerShell or something else) that would run through a folder and create Fixture file (in your test folder) for each presenter, and then add the new files to your test project. It should not take too long....

Michael Puleio - patterns & practices
Webhttp://msdn.microsoft.com/practices/
Bloghttp://blogs.msdn.com/mpuleio/
Oct 19, 2007 at 6:04 PM
If I were to add a test project within the modules folder for each module that has been created so far, what would the structure be that I need for the test project to work properly with testing the views?



MichaelPuleio wrote:
Unfortunately, this will not work. You could probably write a quick script (in PowerShell or something else) that would run through a folder and create Fixture file (in your test folder) for each presenter, and then add the new files to your test project. It should not take too long....

Michael Puleio - patterns & practices
Webhttp://msdn.microsoft.com/practices/
Bloghttp://blogs.msdn.com/mpuleio/


Coordinator
Oct 22, 2007 at 4:43 PM
Edited Oct 22, 2007 at 4:43 PM
Rather than explaining it.....
Create a "disposable module" (one you will delete when you are done) and make sure you create unit tests for it. Copy the structure.

There is nothing special about the unit test projects we create: they are normal VSTS Test projects.
If you want to use NUnit instead, replace the references and change the Test attributes as needed.

Enjoy.
Oct 24, 2007 at 4:21 PM
Ok,

I set up the test projects for each module as per your suggestion but I've come across a small problem. I am using alot of ServiceDependencies in the controllers and the test harness doesn't want to see the constructor for it and only wants to see the zero parameter constructor. I can't seem to get the test project to see the constructor with all the service dependencies...any suggestions?



MichaelPuleio wrote:
Rather than explaining it.....
Create a "disposable module" (one you will delete when you are done) and make sure you create unit tests for it. Copy the structure.

There is nothing special about the unit test projects we create: they are normal VSTS Test projects.
If you want to use NUnit instead, replace the references and change the Test attributes as needed.

Enjoy.

Oct 25, 2007 at 6:48 PM
I seem to have found where things are going wrong and it has to do with the contructors. For example, I have an Admin module and an Admin.Tests module. The code in the MockAdminController is inheriting from AdminController. I am receiving error to the effect that there is no AdminConstructor with '0' arguments. And of course the admincontroller constructor doesn't because it has several servicedependencies. How do I go about fixing this? It is causing compile time errors and I can't get the app running with this.

Thanks
Pat.



MichaelPuleio wrote:
Rather than explaining it.....
Create a "disposable module" (one you will delete when you are done) and make sure you create unit tests for it. Copy the structure.

There is nothing special about the unit test projects we create: they are normal VSTS Test projects.
If you want to use NUnit instead, replace the references and change the Test attributes as needed.

Enjoy.

Oct 29, 2007 at 5:35 PM
This is totally frustrating. I can't seem to make tests work with WCSF in which there are multiple Service Dependencies being instantiated at the controller level. Nothing seems to work.

I am open to any ideas on how to fix.

Any ideas? Anyone? Somewhere? Others should have come across this same issue at some point.

Thanks.