Tomas
Tomas

Reputation: 18117

Test code option in VS2010

Is it possible to execute code quick test in VS2010?

For example I would like to test code below just selecting it in code editor and execute it by passing variables?

 public static int GetInt(object value)
    {
        int result;
        Int32.TryParse(GetString(value), out result);
        return result;
    }

I know about Immediate Window but it does not always works and not all code can be tested with it.

Upvotes: 1

Views: 105

Answers (4)

Andrew
Andrew

Reputation: 165

There is an extension for Visual Studio 2010 called Code Scrap which, according to the developer, "Adds a window for writing and executing scraps of code within Visual Studio."

Upvotes: 0

rusty
rusty

Reputation: 2789

Try one of these tools:

Upvotes: 1

Darin Dimitrov
Darin Dimitrov

Reputation: 1038930

You could do this by running the corresponding unit test you wrote before implementing the method. This will ensure that the implementation you just wrote conforms to the expected results you defined in the unit test.

Upvotes: 1

SLaks
SLaks

Reputation: 887479

No.

Instead, you can copy-paste the code into LINQPad and execute it there.

Upvotes: 1

Related Questions