Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9015899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:51:53+00:00 2026-06-16T03:51:53+00:00

I have a class thats sole purpose is to run a method on other

  • 0

I have a class thats sole purpose is to run a method on other classes from an Interface.

Testing the interface of the classes is no problem, but the runner doesn’t actually DO anything and (as it stands) the only parameter passed into the constructor is kept private.

In my case, the classes are importing text files into a database.

internal DataImporter
{
  private List<IFileImporter> _importers;

  public DataImporter(List<IFileImporter> importers){
    _importers = importers;

  public bool RunImporters()
  {
    //foreach importer, call its "Run" method - each one then does whatever it needs to do
    //however, this need not call a specific "Run" method on IFileImporter
    //I have another app that uses IFileImporter to check for presence of a file first
    //then allow user to choose to import or not.
  }

It seems to me there is nothing to test here? I can’t test the value of _importers, and I don’t want to make it public JUST for the sake of testing. DataImporter is specific to this instance, so creating an interface seems to add no benefit.

I’ve re-used IFileImporters elsewhere, but this is the only “bulk” importer, others are called manually from a winforms app, still others are not in this project at all.

So, do I need to test this…what CAN I test about this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T03:51:54+00:00Added an answer on June 16, 2026 at 3:51 am

    In a nutshell, yes. I can think of a number of tests right off the top of my head.

    Your test ensures that all importers are called by mocking out IFileImporters you pass in the constructor. At a minimum it asserts that what you pass in the constructor are actually used by the method.

    A test to ensure that if any importer that raises an exception, your class behaves as you expect.

    A test should assert the behaviour if the list is empty. (default to True return?)

    A test should also assert the behaviour you expect if one or more importers fail. (Are you and-ing or or-ing your importer results for your RunImporters result?)

    Does the method run every importer regardless of if a previous fails, or returns false on the first failure?

    There should also be a test on your constructor or Assertion for if its provided a null list.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a button class thats created from within the onSurfaceCreated method in my
I have a class that is created for the sole purpose of hadnling notifications
Getting a bit peeved now; I have a model and a class thats just
I have a class that has several member classes as attributes. The constructor of
I have a class thats created as a resource: <Window.Resources> <Model:MyModel x:Key=model /> </Window.Resources>
I have a class and got a method that doin so many things in
We have an HTTPModule whose sole purpose is to do url rewriting. By definition
I have a class that has two method in it, one calls a class
I have a Poly3D class in C++, which has a sole member: list<Point_3> using
This will be a newbie question but I'm learning php for one sole purpose

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.