The Artima Developer Community
Sponsored Link

.NET Buzz Forum
InternalsVisibleToAttribute and Unit Testing

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
Richard Jonas

Posts: 147
Nickname: rjonas
Registered: Nov, 2005

Richard Jonas is a .NET sofware developer living in the UK.
InternalsVisibleToAttribute and Unit Testing Posted: Oct 21, 2006 6:11 AM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Richard Jonas.
Original Post: InternalsVisibleToAttribute and Unit Testing
Feed Title: Richard Jonas
Feed URL: http://feeds.feedburner.com/blogspot/ouNA
Feed Description: Richard Jonas's blog about .NET, web development and agile methodologies.
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Richard Jonas
Latest Posts From Richard Jonas

Advertisement
When creating unit tests to be run with NUnit, I like to keep my tests in a separate assembly, which is not delivered when my project is deployed.

This can make it difficult to create unit tests for classes that should not be visible outside of that assembly. One of my classes uses one of 3 strategy classes that encapsulate a feature of the business logic. I would normally declare these with the intern access modifier, but to test each strategy works I've needed to make them publically available.

If, however, I add the [assembly: InternalsVisibleTo("UnitTests")] line to my AssemblyInfo.cs file, any objects declared with the intern access modifier can be seen by the UnitTests assembly.

Read: InternalsVisibleToAttribute and Unit Testing

Topic: MOSS 2007 - Shared Services architecture Previous Topic   Next Topic Topic: SharePoint Feature - Master Pages for Site Collections

Sponsored Links



Google
  Web Artima.com   

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