Skip to content

Commit

Permalink
builder tests
Browse files Browse the repository at this point in the history
  • Loading branch information
KennyBu committed Aug 15, 2011
1 parent d01d6a5 commit 9e34d48
Show file tree
Hide file tree
Showing 59 changed files with 5,218 additions and 24 deletions.
66 changes: 66 additions & 0 deletions BuilderTest/BuilderTest.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?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>{65CA1944-C04F-4947-91AB-7A2684E19A82}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BuilderTest</RootNamespace>
<AssemblyName>BuilderTest</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>
</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="Ninject">
<HintPath>..\DecoratorTest\packages\Ninject.2.2.1.4\lib\net40-Full\Ninject.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="Customer.cs" />
<Compile Include="CustomerBuilder.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.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>
35 changes: 35 additions & 0 deletions BuilderTest/Customer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
namespace BuilderTest
{
public interface ICustomer
{
string FirstName { get; set; }
string LastName { get; set; }
}

public interface IHaveanAddress
{
string Street { get; set; }
string City { get; set; }
string Zip { get; set; }
}

public interface IHaveCustomerWithAddress : ICustomer, IHaveanAddress
{

}

public class Customer : ICustomer
{
public string FirstName { get; set; }
public string LastName { get; set; }
}

public class CustomerWithAddress : IHaveCustomerWithAddress
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string Street { get; set; }
public string City { get; set; }
public string Zip { get; set; }
}
}
57 changes: 57 additions & 0 deletions BuilderTest/CustomerBuilder.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
namespace BuilderTest
{



public class CustomerBuilder
{
private string _firstName { get; set; }
private string _lastName { get; set; }

public CustomerBuilder WithFirstName(string firstName)
{
_firstName = firstName;
return this;
}

public CustomerBuilder WithLastName(string lastName)
{
_lastName = lastName;
return this;
}

public ICustomer Build()
{
return new Customer{FirstName = _firstName, LastName = _lastName};
}
}

public class CustomerWithAddressBuilder
{
private string _street { get; set; }
private string _city { get; set; }
private string _zip { get; set; }

public CustomerWithAddressBuilder WithFirstName(string street)
{
_street = street;
return this;
}

public CustomerWithAddressBuilder WithCity(string city)
{
_city = city;
return this;
}

public CustomerWithAddressBuilder WithZip(string zip)
{
_zip = zip;
return this;
}




}
}
21 changes: 21 additions & 0 deletions BuilderTest/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;

namespace BuilderTest
{
class Program
{
static void Main()
{
const string firstName = "Luke";
const string lastName = "Skywalker";

var customer = new CustomerBuilder()
.WithFirstName(firstName)
.WithLastName(lastName)
.Build();

Console.WriteLine("Customer: FirstName={0} LastName={1}",customer.FirstName,customer.LastName);
Console.Read();
}
}
}
36 changes: 36 additions & 0 deletions BuilderTest/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -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("BuilderTest")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("BuilderTest")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
[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("2b4a79e0-a09c-46b3-b018-80d2421b2b10")]

// 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")]
3 changes: 3 additions & 0 deletions BuilderTest/app.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
Binary file added BuilderTest/bin/Debug/BuilderTest.exe
Binary file not shown.
3 changes: 3 additions & 0 deletions BuilderTest/bin/Debug/BuilderTest.exe.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
Binary file added BuilderTest/bin/Debug/BuilderTest.pdb
Binary file not shown.
Binary file added BuilderTest/bin/Debug/BuilderTest.vshost.exe
Binary file not shown.
3 changes: 3 additions & 0 deletions BuilderTest/bin/Debug/BuilderTest.vshost.exe.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
11 changes: 11 additions & 0 deletions BuilderTest/bin/Debug/BuilderTest.vshost.exe.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
Binary file added BuilderTest/bin/Debug/Ninject.dll
Binary file not shown.
Binary file added BuilderTest/bin/Debug/Ninject.pdb
Binary file not shown.
Loading

0 comments on commit 9e34d48

Please sign in to comment.