Barryman9000
Barryman9000

Reputation: 53

Test C# code without building my application

I'm trying some string manipulation in my web app, but I don't want to compile the whole application just to see the result something simple.

Is there a (preferably free) tool I can use to do quick tests, or is there something in VS2008 I can use?

Thanks

Upvotes: 3

Views: 722

Answers (6)

Randolpho
Randolpho

Reputation: 56391

Use the unit testing framework that comes bundled with VS2008.

Note: You'll still have to build whatever project contains the code -- you can't get around that -- but you won't have to build the whole solution.

Upvotes: 1

Matthew Whited
Matthew Whited

Reputation: 22433

If the string you want to change is in the ASPX page it's self you can just edit the page and save it. A simple refresh should update the results. If it is a variable value you should be able to use the Watch Window to change the value.

If you want a programmatic solution for testing a method you can either use the built in MSTEST, a simple custom console app, or one of the other unit test frameworks.

Upvotes: 0

meklarian
meklarian

Reputation: 6625

If you're just looking to try out a few statements in immediate mode, LINQpad is great for writing short snippets.

LINQPad Homepage

Upvotes: 7

Juri Glass
Juri Glass

Reputation: 91533

I recommend you to test functionalities like this with unit tests. I don't know C#, but there must be many frameworks and/or libs.

Upvotes: 0

sbi
sbi

Reputation: 224049

The common way to test a piece of code without building/running the whole application is unit tests. There are several frameworks helping you to do this.

For C#, I have used NUnit.

Upvotes: 1

Jay Riggs
Jay Riggs

Reputation: 53593

Take a look at NUnit

Visual Studio 2008 has some built in unit test capability.

Upvotes: 6

Related Questions