Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

How design patterns can help you in developing unit testing-enabled applications

, 15 Nov 2007 CPOL
This article shows how you can mix together Model-View-Presenter, Domain Model, Services, ActiveRecord, and Repository patterns to create a testable application.
Northwind.zip
nunit.framework.dll
Northwind.DataAccess
Northwind.DataAccess.csproj.user
Properties
Query
Repository
Northwind.DataAccess.Test
Northwind.DataAccess.Test.csproj.user
Properties
Northwind.Domain
Dao
Model
Northwind.Domain.csproj.user
Presentation
Properties
Repository
TransferObjects
Northwind.Domain.Test
Northwind.Domain.Test.csproj.user
Properties
Northwind.Presentation
Northwind.Presentation.csproj.user
Properties
Northwind.Presentation.Test
Northwind.Presentation.Test.csproj.user
Properties
Northwind.Services
Northwind.Services.csproj.user
Properties
Northwind.Services.Test
Northwind.Services.Test.csproj.user
Properties
Northwind.TransferObjects
Model
Northwind.TransferObjects.csproj.user
Presentation
Properties
Northwind.TransferObjects.Test
Northwind.TransferObjects.Test.csproj.user
Properties
Northwind.UI
Northwind.UI.csproj.user
NorthWind.UI.suo
Properties
Settings.settings
Northwind.UI.Controls
Northwind.UI.Controls.csproj.user
Properties
Castle.ActiveRecord.dll
Castle.Core.dll
Iesi.Collections.dll
log4net.dll
NHibernate.dll
NMock2.dll
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>8.0.50727</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{8BD6E1A0-F2C6-4CB2-8C7F-EDD9F8E6384A}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>Northwind.TransferObjects.Test</RootNamespace>
    <AssemblyName>Northwind.TransferObjects.Test</AssemblyName>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="Castle.ActiveRecord, Version=0.0.1.3, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL" />
    <Reference Include="Castle.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL" />
    <Reference Include="Iesi.Collections, Version=1.0.0.1, Culture=neutral, PublicKeyToken=154fdcb44c4484fc" />
    <Reference Include="log4net, Version=1.2.9.0, Culture=neutral, PublicKeyToken=b32731d11ce58905" />
    <Reference Include="NHibernate, Version=1.0.2.0, Culture=neutral, PublicKeyToken=154fdcb44c4484fc" />
    <Reference Include="NMock2, Version=1.0.2021.30483, Culture=neutral, processorArchitecture=MSIL" />
    <Reference Include="nunit.framework, Version=2.2.7.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL" />
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Properties\AssemblyInfo.cs" />
    <Compile Include="TOHelperTest.cs" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\Northwind.Domain\Northwind.Domain.csproj">
      <Project>{10B46AA4-7070-47D7-9E6B-4173AEACE38D}</Project>
      <Name>Northwind.Domain</Name>
    </ProjectReference>
    <ProjectReference Include="..\Northwind.TransferObjects\Northwind.TransferObjects.csproj">
      <Project>{D7CEFFFD-1EF4-4760-A41F-FA4AA559B1BB}</Project>
      <Name>Northwind.TransferObjects</Name>
    </ProjectReference>
  </ItemGroup>
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Marcelo Ricardo de Oliveira
Software Developer
Brazil Brazil
Marcelo Ricardo de Oliveira is a senior software developer who lives with his lovely wife Luciana and his little buddy and stepson Kauê in Guarulhos, Brazil, is co-founder of the Brazilian TV Guide TV Map and currently works for ILang Educação.
 
He is often working with serious, enterprise projects, although in spare time he's trying to write fun Code Project articles involving WPF, Silverlight, XNA, HTML5 canvas, Windows Phone app development, game development and music.
 
Published Windows Phone apps:
 
 
Awards:
 
CodeProject MVP 2012
CodeProject MVP 2011
 
Best Web Dev article of March 2013
Best Web Dev article of August 2012
Best Web Dev article of May 2012
Best Mobile article of January 2012
Best Mobile article of December 2011
Best Mobile article of October 2011
Best Web Dev article of September 2011
Best Web Dev article of August 2011
HTML5 / CSS3 Competition - Second Prize
Best ASP.NET article of June 2011
Best ASP.NET article of May 2011
Best ASP.NET article of April 2011
Best C# article of November 2010
Best overall article of November 2010
Best C# article of October 2010
Best C# article of September 2010
Best overall article of September 2010
Best overall article of February 2010
Best C# article of November 2009

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.141223.1 | Last Updated 15 Nov 2007
Article Copyright 2007 by Marcelo Ricardo de Oliveira
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid