Archive for November, 2011

Visual Studio 2010 / SP1 / Windows SDK Install Order

When you plan to install the Windows 7/2008 R2 SDK, the SDK needs to be installed before VS2010 SP1.  Here is the recommended install order:

1. Visual Studio 2010
2. Windows SDK 7.1
3. Visual Studio 2010 SP1
4. Visual C++ 2010 SP1 Compiler Update for the Windows SDK 7.1

Here is the link to the blog post about this: http://blogs.msdn.com/b/vcblog/archive/2011/03/31/10148110.aspx

Unit Testing Private Static Methods in C#

I had never needed to unit test a private static class method in C# before, but it turns out that Microsoft created a special object type to handle just such a case.

To test the private static method DetermineFilename (that takes filePath as a string parameter and returns a string) in the FileManager class, do the following:

PrivateType privateFileManagerObject = new PrivateType(typeof(FileManager));
string filename = (string)privateFileManagerObject.InvokeStatic("DetermineFilename", filePath);

Thanks to Venkat for posting this solution on his web site here:
http://venkatcsharpinterview.blogspot.com/2011/07/unit-testing-private-static-method-in-c.html

Get SQL Server Version/Edition Information

Just connect to the database in which you are interested, open a new query window, and enter the following query:

SELECT SERVERPROPERTY('ProductVersion') as 'Product Version',
SERVERPROPERTY('ProductLevel') as 'Product Level',
SERVERPROPERTY('Edition') as 'Edition'

For me, this produced the following:

Product Version  Product Level  Edition
10.50.1600.1     RTM            Enterprise Edition (64-bit)
Go to Top