Stephen D. Ritchie's Blog, page 4
February 9, 2012
Where’s CAT.NET 2.0?
If you go to the Microsoft Security Development Lifecycle implementation page, you read about performing static analysis with CAT.NET. If you follow one of the download links it takes you to CAT.NET v1 CTP.
About a year ago the Beta version of CAT.NET 2.0 was out from the Microsoft Security Tools team. It looked very promising. Today, I am having trouble finding the download for CAT.NET 2.0. The link on the team’s CAT.NET 2.0 – Beta blog post is broken.
There is very little information on the I...
Where's CAT.NET 2.0?
If you go to the Microsoft Security Development Lifecycle implementation page, you read about performing static analysis with CAT.NET. If you follow one of the download links it takes you to CAT.NET v1 CTP.
However, about a year about the Beta version of CAT.NET 2.0 was out from the Microsoft Security Tools team. It looked very promising. Today, I am having trouble finding the download for CAT.NET 2.0. The link on the team's CAT.NET 2.0 – Beta blog post is broken.
There is very little...
February 7, 2012
Four Ways to Fake Time, Part 3
In Part 2 of this four part series you learned how to use a class property to change the code's dependency on the system clock to make the code easier to test. Adding the Now property is effective, however, adding a new property to every class isn't always the best solution.
I don't remember exactly when I first encountered the IClock interface. I do remember having to deal with the testability challenges of the system clock about 5 years ago. I was developing a scheduling module and needed...
February 3, 2012
.NET Developer's Journal Book Review
Tad Anderson wrote an excellent review of Pro .NET Best Practices in the .NET Developer's Journal.
Here's a link to Tad's original blog post: Real World Software Architecture: Pro .NET Best Practices Book Review
January 31, 2012
Four Ways to Fake Time, Part 2
In Part 1 of this four part series you learned how a code's implicit dependency on the system clock can make the software difficult to test. The first post presented a very simple solution, pass in the clock as a method parameter. It is effective, however, adding a new parameter to every method of a class isn't always the best solution.
Fake Time 2: Brute Force Property InjectionHere is a second way to fake time. It is brute force in the sense that it is rudimentary. Using full-blown...
January 26, 2012
Four Ways to Fake Time
Are your unit tests failing because the code-under-test is coupled to the system clock? In other words, does the method you are testing use the System.DateTime.Now property, and that dependency is making it hard to properly unit test the code?
This series of posts presents four ways to fake time as a means of improving testability. Specifically, we'll look at these four techniques:
The Optional 'clock' ParameterBrute Force Property InjectionInject The IClock InterfaceMock Isolation FrameworkTim...January 19, 2012
Crossderry Interview
Earlier in the month, Crossderry interviewed me about my book Pro .NET Best Practices. Below is the entire four-part interview. Reprinted with the permission of @crossderry.
Project Mgmt and Software Dev Best PracticeQ: Your book's title notwithstanding, you're keen to move people away from the term "best practices." What is wrong with "best practices"?
A: My technical reviewer, Paul Apostolescu, asked me the same question. Paul often prompted me to really think things through.
I routinely...
January 12, 2012
The Prime Directive
When creating test cases, I find that using prime numbers helps avoid coincidental arithmetic issues and helps make debugging easier.
A common coincidental arithmetic problem occurs when a test uses the number 2. These three expressions: 2 + 2, 2 * 2, and System.Math.Pow(2, 2) are all equal to 4. When using the number 2 as a test value, there are many ways the test falsely passes. Arithmetic errors are less likely to yield an improper result when the test values are different prime numbers.
Con...
January 11, 2012
Get 40% off Pro .NET Best Practices!
Apress is currently running a promotion for Pro .NET Best Practices. This is for a limited time.
Until 25-Jan 2012, you can get 40% off the Pro .NET Best Practices eBook from the Apress website when you apply the promo code PNBP125.
Follow these stepsGo to the Pro .NET Best Practices page at apress.com: http://www.apress.com/9781430240235
Select the "Buy eBook" button
Enter the promo code: PNBP125
Press the "Apply Discount" button
Proceed to checkout
Avail...
December 21, 2011
NuGet Kickstart Package
I want to use NuGet to retrieve a set of content files that are needed for the build. For example, the TeamCity build configuration runs a runner.msbuild script, however, that script needs to import a Targets file, like this:
The plan is to create a local NuGet feed that has all the prerequisite files for the build script. Using the local NuGet feed, install the "global build" package as the first build task. After that, the primary build script can find the import file and proceed...


