hash_bucket()

Archive for January 2009

After listening once to Milord by Edith Piaf, she suddenly humms the refrain… … ??

Advertisements

Here’s a little gem.

Most people like to keep their unit test assemblies and code separate from the code being tested (maintainability is such a nice thing). This however raises the issue of how to write tests for methods and classes that are marked internal.

Lots of different approaches exist, such as editing the *.csproj file by hand to include (inject) the code file containing the tests in to the code being tested. This, however is not a very smooth approach.

Thankfully there is a much easier approach using a technique called Friend Assemblies. Basically it’s a way of saying that Assembly A and Assembly B are friends, meaning that B can peek into A’s little secrets marked Internal.
Here’s how to set this up:

1. Add the Assembly Attribute ‘InternalsVisibleTo’ to the assembly being tested:
This goes into the file ‘AssemblyInfo.cs’, an autogenerated file in the Properties folder of your project.

[assembly: InternalsVisibleTo(“Tests.dll”)]

2. Make sure that the assembly containing the tests reference the assembly being tested, and that the output matches the name you typed in the Assembly Attribute (in this case ‘Tests.dll’).

One good thing to know is that sometimes your assemblies fail to make friends because the output of you test assembly has not been explicitly named. In such cases you should make sure to compile the test assembly using the ‘/out:’ switch.
/out:Tests.dll

As always, MSDN has the full story here:
http://msdn.microsoft.com/en-us/library/0tke9fxk(VS.80).aspx

and here:
http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.internalsvisibletoattribute.aspx

Here’s a list of links to the free tools in my current Development Environment (in no particular order):

Testing:

Versioning

Integration / Build

Mocking

Metrics / Profiling

Documentation

Analysis / Visualization

Use them, they’re good :)

Windows 7

Posted on: January 12, 2009

Ok, so I pulled the previous post on Windows 7 since it didn’t really make much sense. Instead I will write up a little review of my experience setting it up and running it, when time so permits.

In the mean time, let me just say that I am impressed and pleased with the whole experience so far. Performance, looks and the general feel of the OS is great! I highly encourage you to take it for a spin:

http://www.microsoft.com/windows/windows-7

Generally I guess I would echo what many others have said already, Windows 7 is what Vista was meant to be. I will add to this and say that Vista was probably released as a giant Beta of Windows 7, in part to gather feedback ;) maybe… who knows?


.

This blog has no clear focus. It has a focus though, it's just not very clear at the moment...

Dev Env.

Visual Studio 2008 Prof / NUnit / Gallio / csUnit / STools (ExactMagic) / doxygen / dxCore / TypeMock / TestDriven.net / SequenceViz / CLRProfiler / Snoop / Reflector / Mole / FxCop / Subversion / TortoiseSVN / SlikSVN / CruiseControl.net / msbuild / nant

Blog Stats

  • 81,435 hits