Seeking Advice: Testing Individual C# Classes Without Running the Entire Program
RutabagaJumpy3956 shares their challenges with testing C# code segments without executing the entire program and seeks advice from the community about better approaches.
Background
The author, RutabagaJumpy3956, describes their struggles transitioning from Python to C# when it comes to testing code. In Python, they were accustomed to quickly creating a new file and running code snippets independently. However, their C# program consists of multiple classes, and testing a single class requires modifying the main workflow.
Challenges Mentioned
- Testing individual C# classes without running the whole application
- The inconvenience of having to edit the core workflow or create multiple projects just to test small code segments
- Dissatisfaction with .NET Fiddle due to missing features like IntelliSense and some library support
- Hesitance to create or switch projects for small tests
Current Solutions Tried
- Editing main program execution flow (not ideal)
- Using .NET Fiddle (lacks IntelliSense and full-featured libraries)
- Considering opening new projects, but finding it time-consuming
Desired Outcome
- A quick and simple way to interactively test C# code (similar to Python’s workflow)
- Ability to test portions of code (like classes or lambda expressions) without altering or executing the whole application
Query to the Community
The author asks: “Do you guys have a suggestion?” They are looking for practical approaches, tools, or workflows, specifically for C# development, to make code exploration and testing more efficient and developer-friendly.
This post appeared first on “Reddit CSharp”. Read the entire article here