Solved

Class parameter and run

Posted on 2011-09-02
2
195 Views
Last Modified: 2013-12-17
Hello team,

I've got class #1 that takes several parameters then performs an action.  One of the parameters is for a unit test class.  All unit test classes will have a 'Run' method but will have differing test logic, since every unit test is different.  How do I setup class #1 to call the 'Run' method on dynamically changing unit test classes being passed in?  Is this a place to use declare an interface?
0
Comment
Question by:Phil5780
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 12

Accepted Solution

by:
Wouter Boevink earned 500 total points
ID: 36474337
Actually an interface could help you to your solution however I'm a little concerned about the used methodology.
All you test code should be in your Unit Tests, the production code should not be aware of (or contain) the test methods.

Basicly it should be something like this:

You write your class.
You write your function
You test that function with a unit test

You are the one that runs the unit tests not your class. Or maybe I don't understand the question.
0
 

Author Closing Comment

by:Phil5780
ID: 36711401
Thanks, interfaces were exactly what I needed.
0

Featured Post

Learn by Doing. Anytime. Anywhere.

Do you like to learn by doing?
Our labs and exercises give you the chance to do just that: Learn by performing actions on real environments.

Hands-on, scenario-based labs give you experience on real environments provided by us so you don't have to worry about breaking anything.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question