The Artima Developer Community
Sponsored Link

.NET Buzz Forum
A simple way to unit-test internal classes

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Roy Osherove

Posts: 1807
Nickname: royo
Registered: Sep, 2003

Roy Osherove is a .Net consultant based in Israel
A simple way to unit-test internal classes Posted: Jul 10, 2004 12:20 PM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Roy Osherove.
Original Post: A simple way to unit-test internal classes
Feed Title: ISerializable
Feed URL: http://www.asp.net/err404.htm?aspxerrorpath=/rosherove/Rss.aspx
Feed Description: Roy Osherove's persistent thoughts
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Roy Osherove
Latest Posts From ISerializable

Advertisement
Jamie Cansdale (Of Nunit Add-in fame)has been cool enough to share with me a quick way that allows you to test internal classes in your project without referencing the Nunit framework DLL. it's pretty simple, actually.
He simply put the whole NUnit framework attributes and assert class in one cs file.
 
that's pretty elegant and I'll have to remember that the next time I need this technique.
There are two other ways I can think of to test internal classes:
  1. Use tests inside the project and enclose them inside conditional compilation arguments
  2. Use a separate test project and “link“ to the actual source files you want to use
    1. Right click on project
    2. Add Existing item
    3. in the browse dialog, highlight the file in the tested project
    4. open the small menu on the 'Open“ button
    5. select “Link file“
    6. Note: this only works for classes that have dependencies that are shared between the test and the tested project so it might get a bit too much work if you have large dependencies in your class files.

Read: A simple way to unit-test internal classes

Topic: Hilarious Previous Topic   Next Topic Topic: INETA : VB.NET World Tour 2004 München (Live + Webcast)

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use