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

  • SEARCH
  • Home
  • 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 7887123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:29:52+00:00 2026-06-03T05:29:52+00:00

I have a Test Project in Visual Studio I’d like to use to test

  • 0

I have a Test Project in Visual Studio I’d like to use to test my console application with (in the same solution).

I’m trying to set up tests which call the console app with specific parameters, and compare the actual output with what I expect, then do my usual Assert statements to appropriately pass/fail the test.

The best way to do this, that I can come up with, is to execute the app exe with System.Diagnostics.Process inside the unit test. This works. I can read the output, and all is well.

The problem I’m having is when I want to set a breakpoint inside the console app code, so I can do some debugging. Since Process kicked off the console app, Visual Studio isn’t watching the console app, so it won’t break. There’s nothing like “Wait for a request from an external application” like there is with Web Apps, and I understand why, but that’s basically what I’m looking for.

So my question is, is there any way to set up these unit tests inside Visual Studio, where I can still debug the console app? The only workaround I can think of is setting the Start Action on the console application to start an external program, which would call MSTest.exe, and run the appropriate unit tests that way. But this seems like a problem which I’m just thinking about it wrong, and there actually is a much more obvious solution.

  • 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-03T05:29:54+00:00Added an answer on June 3, 2026 at 5:29 am

    Make your console application as thin as possible, and move all business logic to domain classes. E.g.

    class Program
    {
        static void Main(string[] args)
        {
           Foo foo = new Foo(args);
        }
    }
    

    After that you can easily write unit tests for your Foo class.

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

Sidebar

Related Questions

I have a Visual Studio solution containing 2 project: main project and test (via
I have a unit test project set up in the same solution as my
I have a unit test project in Visual Studio 2010 (.NET 4) that utilizes
how i can configure the Test Project of visual studio to use all CPU's
I have a visual studio c test project (Helloworld project) created from VS 2008
I'm trying to use SpecFlow in our (Visual Studio 2008) project to define executable
I was trying a test project for creating a visual studio addin in C#.
For some reason, my visual studio 2008 installation doesn't have the Create Test Project
I have a test project in visual studio 2010. I have a TestMethod. Inside
I have configured Visual Studio 2010 to debug xUnit.net tests by setting the Project

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.