Permalink
Browse files

missed files of initial checkin

  • Loading branch information...
1 parent eb33516 commit 4ce3e0db519d7f85d5f35cb3339414abcf593084 bnie committed Jan 15, 2013
View
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PeopleFinder", "PeopleFinder\PeopleFinder.csproj", "{26CA09FB-3D91-49BC-8B78-7CFCA66EFAAD}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x86 = Debug|x86
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {26CA09FB-3D91-49BC-8B78-7CFCA66EFAAD}.Debug|x86.ActiveCfg = Debug|x86
+ {26CA09FB-3D91-49BC-8B78-7CFCA66EFAAD}.Debug|x86.Build.0 = Debug|x86
+ {26CA09FB-3D91-49BC-8B78-7CFCA66EFAAD}.Release|x86.ActiveCfg = Release|x86
+ {26CA09FB-3D91-49BC-8B78-7CFCA66EFAAD}.Release|x86.Build.0 = Release|x86
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace PeopleFinder {
+ public class People {
+ private readonly IRepository<Person> _repository;
+
+ public People(IRepository<Person> repository) {
+ this._repository = repository;
+ }
+
+ public IEnumerable<Person> Query(Func<Person, bool> predicate) {
+ return this._repository.GetAll().Where(predicate).ToList();
+ }
+ }
+}
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{26CA09FB-3D91-49BC-8B78-7CFCA66EFAAD}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>PeopleFinder</RootNamespace>
+ <AssemblyName>PeopleFinder</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <TargetFrameworkProfile>Client</TargetFrameworkProfile>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <PlatformTarget>x86</PlatformTarget>
+ <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|x86' ">
+ <PlatformTarget>x86</PlatformTarget>
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Moq">
+ <HintPath>..\packages\Moq.4.0.10827\lib\NET40\Moq.dll</HintPath>
+ </Reference>
+ <Reference Include="nunit.framework">
+ <HintPath>..\packages\NUnit.2.6.2\lib\nunit.framework.dll</HintPath>
+ </Reference>
+ <Reference Include="Ploeh.AutoFixture">
+ <HintPath>..\packages\AutoFixture.2.16.1\lib\net35\Ploeh.AutoFixture.dll</HintPath>
+ </Reference>
+ <Reference Include="Ploeh.AutoFixture.AutoMoq">
+ <HintPath>..\packages\AutoFixture.AutoMoq.2.16.1\lib\net35\Ploeh.AutoFixture.AutoMoq.dll</HintPath>
+ </Reference>
+ <Reference Include="Ploeh.SemanticComparison">
+ <HintPath>..\packages\AutoFixture.2.16.1\lib\net35\Ploeh.SemanticComparison.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="People.cs" />
+ <Compile Include="PeopleTests.cs" />
+ <Compile Include="Person.cs" />
+ <Compile Include="PeopleRepository.cs" />
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="packages.config" />
+ </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>
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace PeopleFinder {
+ public interface IRepository<out T> where T : DomainObject {
+ IEnumerable<T> GetAll();
+ }
+
+ public class PersonRepository : IRepository<Person> {
+ private static IEnumerable<Person> _people;
+
+ private static IEnumerable<Person> GetPeople() {
+ if (_people != null) return _people;
+
+ _people = new List<Person>
+ {
+ new Person {FirstName = "John", LastName = "Doe"},
+ new Person {FirstName = "Jane", LastName = "Doe"},
+ new Person {FirstName = "John", LastName = "Smith"},
+ new Person {FirstName = "Matthew", LastName = "MacDonald"},
+ new Person {FirstName = "Andrew", LastName = "MacDonald"}
+ };
+
+ return _people;
+ }
+
+ public IEnumerable<Person> GetAll() {
+ return GetPeople();
+ }
+ }
+}
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using NUnit.Framework;
+
+namespace PeopleFinder {
+ [TestFixture]
+ public class PeopleTests {
+ [Test]
+ public void Should_Return_Two_Persons_With_FirstName_John() {
+ // Setup
+ var repository = new PersonRepository();
+ var people = new People(repository);
+
+ // Action
+ var persons = people.Query(p => p.FirstName == "John");
+
+ // Verify the result
+ Assert.AreEqual(persons.Count(), 2, "Should return 2 persons with first name John.");
+ }
+
+ [Test]
+ public void Should_Return_Two_Persons_With_LastName_MacDonald(){
+ // Setup
+ var repository = new PersonRepository();
+ var people = new People(repository);
+
+ // Action
+ var persons = people.Query(p => p.LastName == "MacDonald");
+
+ // Verify the result
+ Assert.AreEqual(persons.Count(), 2, "Should return 2 persons with last name MacDonald.");
+ }
+ }
+}
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace PeopleFinder {
+ public abstract class DomainObject { }
+
+ public class Person : DomainObject {
+ public string FirstName { get; set; }
+ public string LastName { get; set; }
+ }
+}
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace PeopleFinder {
+ class Program {
+ static void Main(string[] args) {
+ var repository = new PersonRepository();
+
+ var people = new People(repository);
+
+ var persons = people.Query(p => p.FirstName == "John");
+
+ foreach (var person in persons) {
+ Console.WriteLine("{0} {1}", person.FirstName, person.LastName);
+ }
+
+ Console.WriteLine();
+ Console.Write("Press any key to continue...");
+ Console.ReadKey();
+ }
+ }
+}
@@ -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("PeopleFinder")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("PeopleFinder")]
+[assembly: AssemblyCopyright("Copyright © 2013")]
+[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("0e16cfb5-30a8-4a40-b3fd-4c0766e0ebbc")]
+
+// 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")]
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+ <runtime>
+ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+ <dependentAssembly>
+ <assemblyIdentity name="Moq" publicKeyToken="69f491c39445e920" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.10827.0" newVersion="4.0.10827.0" />
+ </dependentAssembly>
+ </assemblyBinding>
+ </runtime>
+</configuration>
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="AutoFixture" version="2.16.1" targetFramework="net40-Client" />
+ <package id="AutoFixture.AutoMoq" version="2.16.1" targetFramework="net40-Client" />
+ <package id="Moq" version="4.0.10827" targetFramework="net40-Client" />
+ <package id="NUnit" version="2.6.2" targetFramework="net40-Client" />
+</packages>

0 comments on commit 4ce3e0d

Please sign in to comment.