Skip to content

Commit

Permalink
Adding new 'GettingStarted' project to house examples for RhinoMocks
Browse files Browse the repository at this point in the history
  • Loading branch information
TimBarcz committed Nov 21, 2009
1 parent 993a420 commit c95506e
Show file tree
Hide file tree
Showing 7 changed files with 245 additions and 112 deletions.
9 changes: 9 additions & 0 deletions Rhino.Mocks.GettingStarted/GettingStarted.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
This project was created to show users how RhinoMocks works in running code. Tangible examples that teach the basics of mocking and get users familiar with the concepts of mocking and stubbing.

If there are items you would like to see added here or explained more fully please post to the RhinoMocks discussion group:

http://groups.google.com/group/RhinoMocks

Cheers,

Tim Barcz
10 changes: 10 additions & 0 deletions Rhino.Mocks.GettingStarted/Helpers.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Rhino.Mocks.GettingStarted
{
public static class Helpers
{
public static bool Implements<T>(this object @this)
{
return typeof (T).IsAssignableFrom(@this.GetType());
}
}
}
73 changes: 73 additions & 0 deletions Rhino.Mocks.GettingStarted/Rhino.Mocks.GettingStarted.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?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>{59F8A3E2-80C5-4250-909A-16741DF81B23}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Rhino.Mocks.GettingStarted</RootNamespace>
<AssemblyName>Rhino.Mocks.GettingStarted</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="nunit.framework, Version=2.5.2.9222, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\SharedLibs\nunit.framework.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="Helpers.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Stubs.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="GettingStarted.txt" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Rhino.Mocks\Rhino.Mocks.csproj">
<Project>{1E8FECC7-9E9B-4275-A938-D956F5E5D4F8}</Project>
<Name>Rhino.Mocks</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.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
29 changes: 29 additions & 0 deletions Rhino.Mocks.GettingStarted/Stubs.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using NUnit.Framework;

namespace Rhino.Mocks.GettingStarted
{
[TestFixture]
public class Stubs
{
[Test]
public void Demonstrate_Stub_Implements_the_passed_type()
{
// Arrange

// Act
var stub = MockRepository.GenerateStub<IFoo>();

// Assert
Assert.That(stub.Implements<IFoo>());
}

/// <summary>
/// This is just a sample interface, what it is or does isn't really relevant. It could
/// be IUser of IOrder
/// </summary>
public interface IFoo
{
string Name { get; set; }
}
}
}
124 changes: 68 additions & 56 deletions Rhino.Mocks.sln
Original file line number Diff line number Diff line change
@@ -1,56 +1,68 @@
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rhino.Mocks.Tests 3.5", "Rhino.Mocks.Tests\Rhino.Mocks.Tests.csproj", "{C63839EC-BEF3-4DCD-BE23-B6DA21E8BE20}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rhino.Mocks 3.5", "Rhino.Mocks\Rhino.Mocks.csproj", "{1E8FECC7-9E9B-4275-A938-D956F5E5D4F8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rhino.Mocks.Tests.Model", "Rhino.Mocks.Tests.Model\Rhino.Mocks.Tests.Model.csproj", "{3078B943-10A5-41FA-A68A-7C4FC98506A0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|Mixed Platforms = Debug|Mixed Platforms
Debug|Win32 = Debug|Win32
Release|Any CPU = Release|Any CPU
Release|Mixed Platforms = Release|Mixed Platforms
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C63839EC-BEF3-4DCD-BE23-B6DA21E8BE20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C63839EC-BEF3-4DCD-BE23-B6DA21E8BE20}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C63839EC-BEF3-4DCD-BE23-B6DA21E8BE20}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{C63839EC-BEF3-4DCD-BE23-B6DA21E8BE20}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{C63839EC-BEF3-4DCD-BE23-B6DA21E8BE20}.Debug|Win32.ActiveCfg = Debug|Any CPU
{C63839EC-BEF3-4DCD-BE23-B6DA21E8BE20}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C63839EC-BEF3-4DCD-BE23-B6DA21E8BE20}.Release|Any CPU.Build.0 = Release|Any CPU
{C63839EC-BEF3-4DCD-BE23-B6DA21E8BE20}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{C63839EC-BEF3-4DCD-BE23-B6DA21E8BE20}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{C63839EC-BEF3-4DCD-BE23-B6DA21E8BE20}.Release|Win32.ActiveCfg = Release|Any CPU
{1E8FECC7-9E9B-4275-A938-D956F5E5D4F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1E8FECC7-9E9B-4275-A938-D956F5E5D4F8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1E8FECC7-9E9B-4275-A938-D956F5E5D4F8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{1E8FECC7-9E9B-4275-A938-D956F5E5D4F8}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{1E8FECC7-9E9B-4275-A938-D956F5E5D4F8}.Debug|Win32.ActiveCfg = Debug|Any CPU
{1E8FECC7-9E9B-4275-A938-D956F5E5D4F8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1E8FECC7-9E9B-4275-A938-D956F5E5D4F8}.Release|Any CPU.Build.0 = Release|Any CPU
{1E8FECC7-9E9B-4275-A938-D956F5E5D4F8}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{1E8FECC7-9E9B-4275-A938-D956F5E5D4F8}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{1E8FECC7-9E9B-4275-A938-D956F5E5D4F8}.Release|Win32.ActiveCfg = Release|Any CPU
{3078B943-10A5-41FA-A68A-7C4FC98506A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3078B943-10A5-41FA-A68A-7C4FC98506A0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3078B943-10A5-41FA-A68A-7C4FC98506A0}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{3078B943-10A5-41FA-A68A-7C4FC98506A0}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{3078B943-10A5-41FA-A68A-7C4FC98506A0}.Debug|Win32.ActiveCfg = Debug|Any CPU
{3078B943-10A5-41FA-A68A-7C4FC98506A0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3078B943-10A5-41FA-A68A-7C4FC98506A0}.Release|Any CPU.Build.0 = Release|Any CPU
{3078B943-10A5-41FA-A68A-7C4FC98506A0}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{3078B943-10A5-41FA-A68A-7C4FC98506A0}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{3078B943-10A5-41FA-A68A-7C4FC98506A0}.Release|Win32.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(TextTemplating) = postSolution
TextTemplating = 1
EndGlobalSection
EndGlobal
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rhino.Mocks.Tests", "Rhino.Mocks.Tests\Rhino.Mocks.Tests.csproj", "{C63839EC-BEF3-4DCD-BE23-B6DA21E8BE20}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rhino.Mocks", "Rhino.Mocks\Rhino.Mocks.csproj", "{1E8FECC7-9E9B-4275-A938-D956F5E5D4F8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rhino.Mocks.Tests.Model", "Rhino.Mocks.Tests.Model\Rhino.Mocks.Tests.Model.csproj", "{3078B943-10A5-41FA-A68A-7C4FC98506A0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rhino.Mocks.GettingStarted", "Rhino.Mocks.GettingStarted\Rhino.Mocks.GettingStarted.csproj", "{59F8A3E2-80C5-4250-909A-16741DF81B23}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|Mixed Platforms = Debug|Mixed Platforms
Debug|Win32 = Debug|Win32
Release|Any CPU = Release|Any CPU
Release|Mixed Platforms = Release|Mixed Platforms
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C63839EC-BEF3-4DCD-BE23-B6DA21E8BE20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C63839EC-BEF3-4DCD-BE23-B6DA21E8BE20}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C63839EC-BEF3-4DCD-BE23-B6DA21E8BE20}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{C63839EC-BEF3-4DCD-BE23-B6DA21E8BE20}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{C63839EC-BEF3-4DCD-BE23-B6DA21E8BE20}.Debug|Win32.ActiveCfg = Debug|Any CPU
{C63839EC-BEF3-4DCD-BE23-B6DA21E8BE20}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C63839EC-BEF3-4DCD-BE23-B6DA21E8BE20}.Release|Any CPU.Build.0 = Release|Any CPU
{C63839EC-BEF3-4DCD-BE23-B6DA21E8BE20}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{C63839EC-BEF3-4DCD-BE23-B6DA21E8BE20}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{C63839EC-BEF3-4DCD-BE23-B6DA21E8BE20}.Release|Win32.ActiveCfg = Release|Any CPU
{1E8FECC7-9E9B-4275-A938-D956F5E5D4F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1E8FECC7-9E9B-4275-A938-D956F5E5D4F8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1E8FECC7-9E9B-4275-A938-D956F5E5D4F8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{1E8FECC7-9E9B-4275-A938-D956F5E5D4F8}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{1E8FECC7-9E9B-4275-A938-D956F5E5D4F8}.Debug|Win32.ActiveCfg = Debug|Any CPU
{1E8FECC7-9E9B-4275-A938-D956F5E5D4F8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1E8FECC7-9E9B-4275-A938-D956F5E5D4F8}.Release|Any CPU.Build.0 = Release|Any CPU
{1E8FECC7-9E9B-4275-A938-D956F5E5D4F8}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{1E8FECC7-9E9B-4275-A938-D956F5E5D4F8}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{1E8FECC7-9E9B-4275-A938-D956F5E5D4F8}.Release|Win32.ActiveCfg = Release|Any CPU
{3078B943-10A5-41FA-A68A-7C4FC98506A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3078B943-10A5-41FA-A68A-7C4FC98506A0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3078B943-10A5-41FA-A68A-7C4FC98506A0}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{3078B943-10A5-41FA-A68A-7C4FC98506A0}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{3078B943-10A5-41FA-A68A-7C4FC98506A0}.Debug|Win32.ActiveCfg = Debug|Any CPU
{3078B943-10A5-41FA-A68A-7C4FC98506A0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3078B943-10A5-41FA-A68A-7C4FC98506A0}.Release|Any CPU.Build.0 = Release|Any CPU
{3078B943-10A5-41FA-A68A-7C4FC98506A0}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{3078B943-10A5-41FA-A68A-7C4FC98506A0}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{3078B943-10A5-41FA-A68A-7C4FC98506A0}.Release|Win32.ActiveCfg = Release|Any CPU
{59F8A3E2-80C5-4250-909A-16741DF81B23}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{59F8A3E2-80C5-4250-909A-16741DF81B23}.Debug|Any CPU.Build.0 = Debug|Any CPU
{59F8A3E2-80C5-4250-909A-16741DF81B23}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{59F8A3E2-80C5-4250-909A-16741DF81B23}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{59F8A3E2-80C5-4250-909A-16741DF81B23}.Debug|Win32.ActiveCfg = Debug|Any CPU
{59F8A3E2-80C5-4250-909A-16741DF81B23}.Release|Any CPU.ActiveCfg = Release|Any CPU
{59F8A3E2-80C5-4250-909A-16741DF81B23}.Release|Any CPU.Build.0 = Release|Any CPU
{59F8A3E2-80C5-4250-909A-16741DF81B23}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{59F8A3E2-80C5-4250-909A-16741DF81B23}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{59F8A3E2-80C5-4250-909A-16741DF81B23}.Release|Win32.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(TextTemplating) = postSolution
TextTemplating = 1
EndGlobalSection
EndGlobal
112 changes: 56 additions & 56 deletions Rhino.Mocks/Rhino.Mocks.csproj.user
Original file line number Diff line number Diff line change
@@ -1,57 +1,57 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<LastOpenVersion>7.10.3077</LastOpenVersion>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ReferencePath>D:\Code\rhino-mocks\vendor\;D:\Code\rhino-mocks\vendor\net-1.1\;C:\Code\rhino-mocks\vendor\net-1.1\</ReferencePath>
<CopyProjectDestinationFolder>
</CopyProjectDestinationFolder>
<CopyProjectUncPath>
</CopyProjectUncPath>
<CopyProjectOption>0</CopyProjectOption>
<ProjectView>ShowAllFiles</ProjectView>
<ProjectTrust>0</ProjectTrust>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<EnableASPDebugging>false</EnableASPDebugging>
<EnableASPXDebugging>false</EnableASPXDebugging>
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
<EnableSQLServerDebugging>false</EnableSQLServerDebugging>
<RemoteDebugEnabled>false</RemoteDebugEnabled>
<RemoteDebugMachine>
</RemoteDebugMachine>
<StartAction>Project</StartAction>
<StartArguments>
</StartArguments>
<StartPage>
</StartPage>
<StartProgram>
</StartProgram>
<StartURL>
</StartURL>
<StartWorkingDirectory>
</StartWorkingDirectory>
<StartWithIE>false</StartWithIE>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<EnableASPDebugging>false</EnableASPDebugging>
<EnableASPXDebugging>false</EnableASPXDebugging>
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
<EnableSQLServerDebugging>false</EnableSQLServerDebugging>
<RemoteDebugEnabled>false</RemoteDebugEnabled>
<RemoteDebugMachine>
</RemoteDebugMachine>
<StartAction>Project</StartAction>
<StartArguments>
</StartArguments>
<StartPage>
</StartPage>
<StartProgram>
</StartProgram>
<StartURL>
</StartURL>
<StartWorkingDirectory>
</StartWorkingDirectory>
<StartWithIE>false</StartWithIE>
</PropertyGroup>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<LastOpenVersion>7.10.3077</LastOpenVersion>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ReferencePath>D:\Code\rhino-mocks\vendor\;D:\Code\rhino-mocks\vendor\net-1.1\;C:\Code\rhino-mocks\vendor\net-1.1\</ReferencePath>
<CopyProjectDestinationFolder>
</CopyProjectDestinationFolder>
<CopyProjectUncPath>
</CopyProjectUncPath>
<CopyProjectOption>0</CopyProjectOption>
<ProjectView>ProjectFiles</ProjectView>
<ProjectTrust>0</ProjectTrust>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<EnableASPDebugging>false</EnableASPDebugging>
<EnableASPXDebugging>false</EnableASPXDebugging>
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
<EnableSQLServerDebugging>false</EnableSQLServerDebugging>
<RemoteDebugEnabled>false</RemoteDebugEnabled>
<RemoteDebugMachine>
</RemoteDebugMachine>
<StartAction>Project</StartAction>
<StartArguments>
</StartArguments>
<StartPage>
</StartPage>
<StartProgram>
</StartProgram>
<StartURL>
</StartURL>
<StartWorkingDirectory>
</StartWorkingDirectory>
<StartWithIE>false</StartWithIE>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<EnableASPDebugging>false</EnableASPDebugging>
<EnableASPXDebugging>false</EnableASPXDebugging>
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
<EnableSQLServerDebugging>false</EnableSQLServerDebugging>
<RemoteDebugEnabled>false</RemoteDebugEnabled>
<RemoteDebugMachine>
</RemoteDebugMachine>
<StartAction>Project</StartAction>
<StartArguments>
</StartArguments>
<StartPage>
</StartPage>
<StartProgram>
</StartProgram>
<StartURL>
</StartURL>
<StartWorkingDirectory>
</StartWorkingDirectory>
<StartWithIE>false</StartWithIE>
</PropertyGroup>
</Project>
Binary file added SharedLibs/nunit.framework.dll
Binary file not shown.

0 comments on commit c95506e

Please sign in to comment.