Solved

Class parameter and run

Posted on 2011-09-02
2
193 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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

730 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