Skip to content
Browse files

refactoring a little for IOC and testability.

  • Loading branch information...
1 parent 0a3bc5b commit 9b9b7120681f448c63a89fba589167376e184275 @nathanb committed Sep 23, 2010
Showing with 597 additions and 142 deletions.
  1. BIN SubSonicDemo/lib/Castle.Core.dll
  2. BIN SubSonicDemo/lib/Machine.Specifications.dll
  3. BIN SubSonicDemo/lib/Machine.Specifications.pdb
  4. BIN SubSonicDemo/lib/Microsoft.Web.Mvc.dll
  5. BIN SubSonicDemo/lib/MvcContrib.FluentHtml.dll
  6. BIN SubSonicDemo/lib/MvcContrib.TestHelper.dll
  7. BIN SubSonicDemo/lib/MvcContrib.dll
  8. +25 −0 SubSonicDemo/lib/RHINO License.txt
  9. BIN SubSonicDemo/lib/Rhino.Mocks.dll
  10. BIN SubSonicDemo/lib/SubSonic.Core.dll
  11. BIN SubSonicDemo/lib/SubSonic.Core.pdb
  12. +58 −0 SubSonicDemo/src/SubSonicDemo.Core/App.config
  13. +1 −1 SubSonicDemo/src/{SubSonicDemo → SubSonicDemo.Core}/Config.cs
  14. +1 −1 SubSonicDemo/src/{SubSonicDemo → SubSonicDemo.Core}/DemoController.cs
  15. +1 −1 SubSonicDemo/src/{SubSonicDemo → SubSonicDemo.Core}/Domain/Category.cs
  16. +1 −1 SubSonicDemo/src/{SubSonicDemo → SubSonicDemo.Core}/Domain/Product.cs
  17. +1 −1 SubSonicDemo/src/{SubSonicDemo → SubSonicDemo.Core}/Implementation/LinqAppService.cs
  18. +1 −1 SubSonicDemo/src/{SubSonicDemo → SubSonicDemo.Core}/Implementation/SS3Repository.cs
  19. +1 −1 SubSonicDemo/src/{SubSonicDemo → SubSonicDemo.Core}/Interfaces/AppService.cs
  20. +1 −1 SubSonicDemo/src/{SubSonicDemo → SubSonicDemo.Core}/Interfaces/LinqRepository.cs
  21. +36 −0 SubSonicDemo/src/SubSonicDemo.Core/Properties/AssemblyInfo.cs
  22. +84 −0 SubSonicDemo/src/SubSonicDemo.Core/SubSonicDemo.Core.csproj
  23. +36 −0 SubSonicDemo/src/SubSonicDemo.Specs/Properties/AssemblyInfo.cs
  24. +211 −0 SubSonicDemo/src/SubSonicDemo.Specs/Report.html
  25. +32 −0 SubSonicDemo/src/SubSonicDemo.Specs/SimpleSpec.cs
  26. +84 −0 SubSonicDemo/src/SubSonicDemo.Specs/SubSonicDemo.Specs.csproj
  27. +16 −0 SubSonicDemo/src/SubSonicDemo.V9.sln
  28. +0 −51 SubSonicDemo/src/SubSonicDemo/Implementation/MockAppService.cs
  29. +0 −59 SubSonicDemo/src/SubSonicDemo/Implementation/MockLinqRepository.cs
  30. +1 −0 SubSonicDemo/src/SubSonicDemo/Program.cs
  31. +6 −24 SubSonicDemo/src/SubSonicDemo/SubSonicDemo.csproj
View
BIN SubSonicDemo/lib/Castle.Core.dll
Binary file not shown.
View
BIN SubSonicDemo/lib/Machine.Specifications.dll
Binary file not shown.
View
BIN SubSonicDemo/lib/Machine.Specifications.pdb
Binary file not shown.
View
BIN SubSonicDemo/lib/Microsoft.Web.Mvc.dll
Binary file not shown.
View
BIN SubSonicDemo/lib/MvcContrib.FluentHtml.dll
Binary file not shown.
View
BIN SubSonicDemo/lib/MvcContrib.TestHelper.dll
Binary file not shown.
View
BIN SubSonicDemo/lib/MvcContrib.dll
Binary file not shown.
View
25 SubSonicDemo/lib/RHINO License.txt
@@ -0,0 +1,25 @@
+Copyright (c) 2005 - 2009 Ayende Rahien (ayende@ayende.com)
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * Neither the name of Ayende Rahien nor the names of its
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
View
BIN SubSonicDemo/lib/Rhino.Mocks.dll
Binary file not shown.
View
BIN SubSonicDemo/lib/SubSonic.Core.dll
Binary file not shown.
View
BIN SubSonicDemo/lib/SubSonic.Core.pdb
Binary file not shown.
View
58 SubSonicDemo/src/SubSonicDemo.Core/App.config
@@ -0,0 +1,58 @@
+<?xml version="1.0"?>
+<configuration>
+ <!--<configSections>
+ <section name="unity" type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection, Microsoft.Practices.Unity.Configuration"/>
+ </configSections>-->
+
+ <!--optional app.config for unity-->
+ <!--<unity>
+ <typeAliases>
+ <typeAlias alias="AppService" type="SubSonicDemo.AppService, SubSonicDemo"/>
+ <typeAlias alias="LinqAppService" type="SubSonicDemo.LinqAppService, SubSonicDemo"/>
+ <typeAlias alias="LinqRepository" type="SubSonicDemo.LinqRepository, SubSonicDemo"/>
+ <typeAlias alias="SS3LinqRepository" type="SubSonicDemo.SS3LinqRepository, SubSonicDemo"/>
+ <typeAlias alias="MockLinqRepository" type="SubSonicDemo.MockLinqRepository, SubSonicDemo"/>
+ <typeAlias alias="MockAppService" type="SubSonicDemo.Repository.MockAppService, SubSonicDemo"/>
+ </typeAliases>
+ <containers>
+ <container>
+ <types>
+ <type type="AppService" mapTo="LinqAppService"/>
+ <type type="LinqRepository" mapTo="SS3LinqRepository"/>
+ </types>
+ </container>
+ </containers>
+ </unity>-->
+
+ <connectionStrings>
+ <clear/>
+ <add name="Sqlite" providerName="System.Data.SQLite" connectionString="Data Source=data.db3;"/>
+ <add name="MySql" providerName="MySql.Data.MySqlClient" connectionString="Data Source=localhost;Database=SubSonicDemo;User id=user;password=pass;"/>
+ <add name="MSSql" providerName="System.Data.SqlClient" connectionString="Data Source=localhost;initial catalog=SubSonicDemo;Integrated Security=true;"/>
+ </connectionStrings>
+
+ <appSettings>
+ <add key="DefaultConnectionStringName" value="Sqlite"/>
+ <add key="RunMigrations" value="True"/>
+ </appSettings>
+
+ <system.data>
+ <DbProviderFactories>
+ <clear/>
+ <add name="SQLite Data Provider"
+ invariant="System.Data.SQLite"
+ description=".Net Framework Data Provider for SQLite"
+ type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite"/>
+
+ <add name="MySQL Data Provider"
+ description="ADO.Net driver for MySQL"
+ invariant="MySql.Data.MySqlClient"
+ type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data"/>
+
+ <add name="MSSQL Data Provider"
+ description="ADO.Net driver for MSSQL"
+ invariant="System.Data.SqlClient"
+ type="System.Data.SqlClient.SqlClientFactory, System.Data"/>
+ </DbProviderFactories>
+ </system.data>
+</configuration>
View
2 SubSonicDemo/src/SubSonicDemo/Config.cs → SubSonicDemo/src/SubSonicDemo.Core/Config.cs
@@ -4,7 +4,7 @@
using System.Text;
using System.Configuration;
-namespace SubSonicDemo
+namespace SubSonicDemo.Core
{
public class Config
{
View
2 ...icDemo/src/SubSonicDemo/DemoController.cs → ...o/src/SubSonicDemo.Core/DemoController.cs
@@ -3,7 +3,7 @@
using System.Linq;
using System.Text;
-namespace SubSonicDemo
+namespace SubSonicDemo.Core
{
public class DemoController
{
View
2 ...cDemo/src/SubSonicDemo/Domain/Category.cs → .../src/SubSonicDemo.Core/Domain/Category.cs
@@ -4,7 +4,7 @@
using System.Text;
using SubSonic.SqlGeneration.Schema;
-namespace SubSonicDemo
+namespace SubSonicDemo.Core
{
//you may optionally specify a custom table name for your domain object.
//If you left this out, it would likely pluralize and pascal case the class name for its table representation
View
2 ...icDemo/src/SubSonicDemo/Domain/Product.cs → ...o/src/SubSonicDemo.Core/Domain/Product.cs
@@ -4,7 +4,7 @@
using System.Text;
using SubSonic.SqlGeneration.Schema;
-namespace SubSonicDemo
+namespace SubSonicDemo.Core
{
//not using table name override.
public class Product
View
2 ...onicDemo/Implementation/LinqAppService.cs → ...emo.Core/Implementation/LinqAppService.cs
@@ -3,7 +3,7 @@
using System.Linq;
using System.Text;
-namespace SubSonicDemo
+namespace SubSonicDemo.Core
{
/// <summary>
View
2 ...SonicDemo/Implementation/SS3Repository.cs → ...Demo.Core/Implementation/SS3Repository.cs
@@ -4,7 +4,7 @@
using System.Text;
using SubSonic.Repository;
-namespace SubSonicDemo
+namespace SubSonicDemo.Core
{
public class SS3LinqRepository : LinqRepository
{
View
2 ...src/SubSonicDemo/Interfaces/AppService.cs → ...ubSonicDemo.Core/Interfaces/AppService.cs
@@ -3,7 +3,7 @@
using System.Linq;
using System.Text;
-namespace SubSonicDemo
+namespace SubSonicDemo.Core
{
public interface AppService
{
View
2 ...SubSonicDemo/Interfaces/LinqRepository.cs → ...nicDemo.Core/Interfaces/LinqRepository.cs
@@ -3,7 +3,7 @@
using System.Linq;
using System.Text;
-namespace SubSonicDemo
+namespace SubSonicDemo.Core
{
public interface LinqRepository
{
View
36 SubSonicDemo/src/SubSonicDemo.Core/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("SubSonicDemo.Core")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("SubSonicDemo.Core")]
+[assembly: AssemblyCopyright("Copyright © 2010")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("41177506-c9ce-456e-9780-2e8d15a2b870")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
View
84 SubSonicDemo/src/SubSonicDemo.Core/SubSonicDemo.Core.csproj
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.30729</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{44704D1B-6706-4B1F-B66A-4A3AD037AE27}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>SubSonicDemo.Core</RootNamespace>
+ <AssemblyName>SubSonicDemo.Core</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </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="mysql.data, Version=6.2.2.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib\mysql.data.dll</HintPath>
+ </Reference>
+ <Reference Include="SubSonic.Core, Version=3.0.0.3, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib\SubSonic.Core.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.configuration" />
+ <Reference Include="System.Core">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Xml.Linq">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Data.DataSetExtensions">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ <Reference Include="Sytem.Data.SQLite, Version=1.0.66.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib\Sytem.Data.SQLite.dll</HintPath>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Config.cs" />
+ <Compile Include="DemoController.cs" />
+ <Compile Include="Domain\Category.cs" />
+ <Compile Include="Domain\Product.cs" />
+ <Compile Include="Implementation\LinqAppService.cs" />
+ <Compile Include="Implementation\SS3Repository.cs" />
+ <Compile Include="Interfaces\AppService.cs" />
+ <Compile Include="Interfaces\LinqRepository.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="App.config">
+ <SubType>Designer</SubType>
+ </None>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\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>
View
36 SubSonicDemo/src/SubSonicDemo.Specs/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("SubSonicDemo.Specs")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("SubSonicDemo.Specs")]
+[assembly: AssemblyCopyright("Copyright © 2010")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("7918326a-2716-41fc-b5c5-a8f6333c6169")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
View
211 SubSonicDemo/src/SubSonicDemo.Specs/Report.html
@@ -0,0 +1,211 @@
+<html>
+<head>
+ <title>Machine.Specifications Report</title>
+ <style type="text/css">body {
+ font-family: Arial,Helvetica,sans-serif;
+ font-size: .9em;
+}
+
+.count {
+ color: lightgrey;
+}
+
+.failure {
+ color: red;
+ font-weight: bold;
+ display: inline;
+}
+
+.notimplemented {
+ color: orange;
+ font-weight: bold;
+ display: inline;
+}
+
+p.exception_type {
+ color: black;
+ font-weight: bold;
+ display: inline;
+}
+
+pre.exception_message {
+ border-style: dashed;
+ border-color: #FF828D;
+ border-width: thin;
+ background-color: #FFD2CF;
+ white-space: pre-wrap; /* CSS2.1 compliant */
+ white-space: -moz-pre-wrap; /* Mozilla-based browsers */
+ white-space: o-pre-wrap; /* Opera 7+ */
+ padding: 1em;
+}
+
+hr {
+ color: lightgrey;
+ border: 1px solid lightgrey;
+ height: 1px;
+}
+
+ul.prev-next {
+ padding: 0;
+ margin: 0;
+ font-size: 2em;
+ }
+
+.spec ul.prev-next {
+ float: right;
+ right: 30%;
+ position: absolute;
+ margin-top: -1em;
+ }
+
+ul.prev-next li {
+ display: inline;
+ padding: 0;
+ margin: 0;
+}
+
+ul.prev-next li a {
+ color: lightgrey;
+ text-decoration: none;
+ font-weight: bold;
+ padding: 0 .3em;
+ border: 1px solid lightgrey;
+}
+
+ul.prev-next li.notimplemented a {
+ border-color: orange;
+}
+
+ul.prev-next li.failure a {
+ border-color: red;
+}
+
+ul.prev-next li.notimplemented a:hover {
+ background-color: orange;
+ color: #000;
+}
+
+ul.prev-next li.failure a:hover {
+ background-color: red;
+ color: #fff;
+}
+
+ul.prev-next li.back a:hover {
+ background-color: #444;
+ color: #fff;
+}
+
+div.supplement {
+ display: none;
+}
+
+@media print {
+ ul.prev-next {
+ display: none;
+ }
+}
+ </style>
+</head>
+<body>
+ <ul class="prev-next"><li class="failure">
+ <a href="#4">Go to first failed specification &dArr;</a>
+ </li><li class="notimplemented">
+ <a href="#3">Go to first not implemented specification &dArr;</a>
+ </li>
+ </ul>
+<h1>
+ SubSonicDemo.Specs
+</h1>
+<h2 class="count">
+ 1 concern,
+ 1 context,
+ 4 specifications,
+ <span class="failure">1 failure</span>,
+ <span class="notimplemented">1 not implemented spec</span>
+</h2>
+
+ <hr/>
+ <hr/>
+<h2 class="concern">
+ Categories specifications
+</h2>
+<h3 class="count">
+ 1 context, 4 specifications
+</h3><h3 class="context">
+ When getting a list of all categories
+</h3>
+<h4 class="count">
+ 4 specifications
+</h4><ul><li class="spec"><a name="1">Should be a list of categories</a>
+
+
+
+
+<script type="text/javascript">
+ function toggleVisibility(id, description)
+ {
+ var section = document.getElementById(id);
+ var link = document.getElementById(id + "_link");
+
+ if (section.style.display == "block")
+ {
+ section.style.display = "none";
+ link.innerHTML = "Show " + description;
+ } else
+ {
+ section.style.display = "block";
+ link.innerHTML = "Hide " + description;
+ }
+ };
+</script>
+
+ </li><li class="spec"><a name="2">Should contain two categories</a>
+
+
+
+
+
+
+ </li><li class="spec"><a name="3">Should do something else not implemented yet</a>
+
+<div class="notimplemented">
+ &lArr; NOT IMPLEMENTED
+ <ul class="prev-next">
+ <li class="prev notimplemented">
+ </li>
+ <li class="next notimplemented">
+ </li>
+ </ul>
+</div>
+
+
+
+
+ </li><li class="spec"><a name="4">Should fail</a>
+
+ <div class="failure">
+ &lArr; FAILED
+ <ul class="prev-next">
+ <li class="failure">
+ </li>
+ <li class="failure">
+ </li>
+ </ul>
+ </div>
+ <p class="exception_type">
+ Exception
+ </p>
+ <pre class="exception_message">System.Exception: kaboom!
+ at SubSonicDemo.Specs.When_getting_a_list_of_all_categories.&lt;.ctor&gt;b__8() in C:\Code\Git\iws-snippets\SubSonicDemo\src\SubSonicDemo.Specs\SimpleSpec.cs:line 30
+ at Machine.Specifications.Model.Specification.InvokeSpecificationField() in d:\BuildAgent-01\work\340c36596c29db8\Source\Machine.Specifications\Model\Specification.cs:line 75
+ at Machine.Specifications.Model.Specification.Verify() in d:\BuildAgent-01\work\340c36596c29db8\Source\Machine.Specifications\Model\Specification.cs:line 53</pre>
+
+
+
+
+
+ </li>
+ </ul>
+ <hr/>
+</body>
+</html>
View
32 SubSonicDemo/src/SubSonicDemo.Specs/SimpleSpec.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Machine.Specifications;
+using Rhino.Mocks;
+
+namespace SubSonicDemo.Specs
+{
+ [Subject("Categories")]
+ public class When_getting_a_list_of_all_categories
+ {
+ static Core.AppService service;
+ static List<Core.Category> result;
+
+ Establish context = () =>
+ {
+ service = MockRepository.GenerateMock<Core.AppService>();
+ service.Stub(o => o.GetAllCategories()).Return(new List<Core.Category>() {
+ new Core.Category() { Name="test1", Id=1},
+ new Core.Category() { Name="test2", Id=2}
+ });
+ };
+
+ Because of = () => { result = service.GetAllCategories(); };
+
+ It Should_be_a_list_of_categories = () => { result.ShouldBeOfType<List<Core.Category>>(); };
+ It Should_contain_two_categories = () => { result.Count.ShouldEqual(2); };
+ It Should_do_something_else_not_implemented_yet;
+ It Should_fail = () => { throw new Exception("kaboom!"); };
+ }
+}
View
84 SubSonicDemo/src/SubSonicDemo.Specs/SubSonicDemo.Specs.csproj
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.30729</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{CE3B38C2-D5DE-4F8F-A65D-F0D9CA1CA989}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>SubSonicDemo.Specs</RootNamespace>
+ <AssemblyName>SubSonicDemo.Specs</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </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="Machine.Specifications, Version=0.3.0.0, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib\Machine.Specifications.dll</HintPath>
+ </Reference>
+ <Reference Include="MvcContrib, Version=2.0.95.0, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib\MvcContrib.dll</HintPath>
+ </Reference>
+ <Reference Include="MvcContrib.TestHelper, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib\MvcContrib.TestHelper.dll</HintPath>
+ </Reference>
+ <Reference Include="Rhino.Mocks, Version=3.6.0.0, Culture=neutral, PublicKeyToken=0b3305902db7183f, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib\Rhino.Mocks.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Core">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Xml.Linq">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Data.DataSetExtensions">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="SimpleSpec.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\SubSonicDemo.Core\SubSonicDemo.Core.csproj">
+ <Project>{44704D1B-6706-4B1F-B66A-4A3AD037AE27}</Project>
+ <Name>SubSonicDemo.Core</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="Report.html" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\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>
View
16 SubSonicDemo/src/SubSonicDemo.V9.sln
@@ -3,6 +3,10 @@ Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SubSonicDemo", "SubSonicDemo\SubSonicDemo.csproj", "{BA48459E-9A66-43A3-B43C-DCCD9B71D56C}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SubSonicDemo.Specs", "SubSonicDemo.Specs\SubSonicDemo.Specs.csproj", "{CE3B38C2-D5DE-4F8F-A65D-F0D9CA1CA989}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SubSonicDemo.Core", "SubSonicDemo.Core\SubSonicDemo.Core.csproj", "{44704D1B-6706-4B1F-B66A-4A3AD037AE27}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -19,6 +23,18 @@ Global
{BA48459E-9A66-43A3-B43C-DCCD9B71D56C}.Release|Any CPU.Build.0 = Release|Any CPU
{BA48459E-9A66-43A3-B43C-DCCD9B71D56C}.Release|x86.ActiveCfg = Release|x86
{BA48459E-9A66-43A3-B43C-DCCD9B71D56C}.Release|x86.Build.0 = Release|x86
+ {CE3B38C2-D5DE-4F8F-A65D-F0D9CA1CA989}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {CE3B38C2-D5DE-4F8F-A65D-F0D9CA1CA989}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {CE3B38C2-D5DE-4F8F-A65D-F0D9CA1CA989}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {CE3B38C2-D5DE-4F8F-A65D-F0D9CA1CA989}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {CE3B38C2-D5DE-4F8F-A65D-F0D9CA1CA989}.Release|Any CPU.Build.0 = Release|Any CPU
+ {CE3B38C2-D5DE-4F8F-A65D-F0D9CA1CA989}.Release|x86.ActiveCfg = Release|Any CPU
+ {44704D1B-6706-4B1F-B66A-4A3AD037AE27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {44704D1B-6706-4B1F-B66A-4A3AD037AE27}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {44704D1B-6706-4B1F-B66A-4A3AD037AE27}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {44704D1B-6706-4B1F-B66A-4A3AD037AE27}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {44704D1B-6706-4B1F-B66A-4A3AD037AE27}.Release|Any CPU.Build.0 = Release|Any CPU
+ {44704D1B-6706-4B1F-B66A-4A3AD037AE27}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
View
51 SubSonicDemo/src/SubSonicDemo/Implementation/MockAppService.cs
@@ -1,51 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace SubSonicDemo
-{
- /// <summary>
- /// this is just a placeholder class to show you could setup unit testing at the service level.
- /// </summary>
- public class MockAppService : AppService
- {
- #region AppService Members
-
- public int CountCategories()
- {
- throw new NotImplementedException();
- }
-
- public List<Category> GetAllCategories()
- {
- throw new NotImplementedException();
- }
-
- public Category GetCategoryById(int id)
- {
- throw new NotImplementedException();
- }
-
- public List<Category> GetCategoryByParentAndName(int id, string name)
- {
- throw new NotImplementedException();
- }
-
- public void SaveCategory(Category data)
- {
- throw new NotImplementedException();
- }
-
- public void DeleteCategory(int id)
- {
- throw new NotImplementedException();
- }
-
- public List<Product> GetProductsByCategory(int p)
- {
- throw new NotImplementedException();
- }
- #endregion
- }
-}
View
59 SubSonicDemo/src/SubSonicDemo/Implementation/MockLinqRepository.cs
@@ -1,59 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace SubSonicDemo
-{
-
- /// <summary>
- /// This is antoher mock class to show that we can setup mocking the core data level. This layer can typically be replaced with other frameworks like EF4 or Nhibernate
- /// </summary>
- public class MockLinqRepository : LinqRepository
- {
-
- #region LinqRepository Members
-
- public IQueryable<T> All<T>() where T : class, new()
- {
- throw new NotImplementedException();
- }
-
- public void Add<T>(T data) where T : class, new()
- {
- throw new NotImplementedException();
- }
-
- public void Add(object data)
- {
- throw new NotImplementedException();
- }
-
- public void AddMany<T>(IEnumerable<T> list) where T : class, new()
- {
- throw new NotImplementedException();
- }
-
- public void Update<T>(T data) where T : class, new()
- {
- throw new NotImplementedException();
- }
-
- public void Delete<T>(object key) where T : class, new()
- {
- throw new NotImplementedException();
- }
-
- public void DeleteMany<T>(IEnumerable<T> list) where T : class, new()
- {
- throw new NotImplementedException();
- }
-
- public void UpdateMany<T>(IEnumerable<T> list) where T : class, new()
- {
- throw new NotImplementedException();
- }
-
- #endregion
- }
-}
View
1 SubSonicDemo/src/SubSonicDemo/Program.cs
@@ -5,6 +5,7 @@
using Microsoft.Practices.Unity;
using Microsoft.Practices.Unity.Configuration;
using System.Configuration;
+using SubSonicDemo.Core;
namespace SubSonicDemo
{
View
30 SubSonicDemo/src/SubSonicDemo/SubSonicDemo.csproj
@@ -96,26 +96,12 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\Microsoft.Practices.Unity.Configuration.dll</HintPath>
</Reference>
- <Reference Include="MySql.Data, Version=6.2.2.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\PhotographyHost\lib\MySql.Data.dll</HintPath>
- <Private>True</Private>
- </Reference>
- <Reference Include="SubSonic.Core, Version=3.0.0.3, Culture=neutral, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\SubSonic.Core.dll</HintPath>
- </Reference>
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data.Linq" />
- <Reference Include="System.Data.SQLite, Version=1.0.66.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=x86">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\System.Data.SQLite.dll</HintPath>
- <Private>True</Private>
- </Reference>
<Reference Include="System.Transactions" />
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
@@ -127,18 +113,8 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
- <Compile Include="Config.cs" />
- <Compile Include="DemoController.cs" />
- <Compile Include="Domain\Product.cs" />
- <Compile Include="Implementation\LinqAppService.cs" />
- <Compile Include="Implementation\MockAppService.cs" />
- <Compile Include="Implementation\MockLinqRepository.cs" />
- <Compile Include="Interfaces\AppService.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="Implementation\SS3Repository.cs" />
- <Compile Include="Domain\Category.cs" />
- <Compile Include="Interfaces\LinqRepository.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config">
@@ -166,6 +142,12 @@
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
<Service Include="{B4F97281-0DBD-4835-9ED8-7DFB966E87FF}" />
</ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\SubSonicDemo.Core\SubSonicDemo.Core.csproj">
+ <Project>{44704D1B-6706-4B1F-B66A-4A3AD037AE27}</Project>
+ <Name>SubSonicDemo.Core</Name>
+ </ProjectReference>
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\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.

0 comments on commit 9b9b712

Please sign in to comment.
Something went wrong with that request. Please try again.