By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,732 Members | 1,388 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,732 IT Pros & Developers. It's quick & easy.

Organizing stubs in a visual studio vb.net solution

P: n/a
I am trying to figure out how to organize a visual studio vb.net
solution to make it possible to execute automated unit tests. I
encounter problems when creating stubs.

When testing an existing system, for which I am not allowed to change
the structure (projects, namespaces and so on) or the implementation
(only correcting faults is allowed), I have the following situation:
-Project "Handlers" -Class "Rodscanner"

Solution "PRS" -Project "PRSFasader" -Class "LoggFasad"

-Project "HandlersTest" -Linked Class "Rodscanner"
-Class "RodscannerTest"
-Class "LoggFasad" (stub)
I want to test the class Rodscanner in namespace WE.PRS.HANDLERS
located in the project Handlers.

The rodscanner class uses the class LoggFasad in namespace
WE.PRS.FASADER located in the project PRSFasader (in the same
solution). The Rodscanner class contains an "imports WE.PRS.FASADER"
statement.

I create another project called HandlersTest. In the HandlersTest
project I link to the file Rodscanner.vb (the class to be tested). I
also create a class called RodscannerTest in the HandlerTest project,
where test cases for the Rodscanner class will be implemented.

Now I need to make a stub for the LoggFasad class to make it possible
to observe and control the LoggFasad class. Is it possible to force the
linked Rodscanner class in the HandlersTest project to use a stub
located in the HandlersTest project instead of the real LoggFasad in
the PRSFasader project?

I do not want to make a copy of the Rodscanner class in the
HandlersTest project, because then I would have to make changes in two
files if I had to correct a fault.

Again, the question is: Is it possible to make the linked Rodscanner
class in the HandlersTest project use the stub LoggFasad so that test
can be run, but make the Rodscanner class in the Handlers project uses
the real LoggFasad class?

If it is not possible in the situation described above, is there
another way of organizing a solution so that it is not necessary to
change between a stub class and the class containing the real
implementation manually?

Nov 30 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.