<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Dotnet Code Tdd on Chris McKelt - Remembering Thoughts</title><link>https://blog.smarttechventures.au/tags/dotnet-code-tdd/</link><description>Recent content in Dotnet Code Tdd on Chris McKelt - Remembering Thoughts</description><generator>Hugo -- 0.147.2</generator><language>en</language><lastBuildDate>Mon, 12 Oct 2009 00:00:00 +0800</lastBuildDate><atom:link href="https://blog.smarttechventures.au/tags/dotnet-code-tdd/index.xml" rel="self" type="application/rss+xml"/><item><title>Context Specification</title><link>https://blog.smarttechventures.au/articles/posts/context-specification/</link><pubDate>Mon, 12 Oct 2009 00:00:00 +0800</pubDate><guid>https://blog.smarttechventures.au/articles/posts/context-specification/</guid><description>&lt;h1 id="context-specification-base-class">Context Specification Base Class&lt;/h1>
&lt;blockquote>
&lt;p>namespace Example
{
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Rhino.Mocks;&lt;/p>
&lt;pre>&lt;code>public abstract class ContextSpecification&amp;lt;T&amp;gt;
{
protected Exception executionException;
protected T sut { get; set; }
[TestInitialize\]
public void Start()
{
this.Context();
this.SetupMockResults();
this.Because();
}
[TestCleanup\]
public void CleanUp()
{
this.Clean();
}
protected virtual void Context()
{
}
protected virtual void SetupMockResults()
{
}
protected virtual void Because()
{
}
protected virtual void Clean()
{
}
protected TInterface GetDependency&amp;lt;TInterface&amp;gt;() where TInterface : class
{
return MockRepository.GenerateMock&amp;lt;TInterface&amp;gt;();
}
public void Execute(Action action)
{
try
{
action();
}
catch (Exception ex)
{
executionException = ex;
}
}
}
&lt;/code>&lt;/pre>
&lt;p>}&lt;/p></description></item></channel></rss>