Skip to content

Commit

Permalink
Added WP7 unit test project
Browse files Browse the repository at this point in the history
Added Solution for SL and WP7 unittesting
  • Loading branch information
remogloor committed Dec 24, 2011
1 parent ccdb018 commit 89750a8
Show file tree
Hide file tree
Showing 20 changed files with 999 additions and 574 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
/build/*
/dist/*
obj
/src/Ninject.Extensions.Factory.5.0.ReSharper.user
/src/Ninject.Extensions.Factory.5.1.TeamCity.user
/src/Ninject.Extensions.Factory/_ReSharper.Ninject.Extensions.Factory/*
_ReSharper.Ninject.Extensions.Factory
_ReSharper.Ninject.Extensions.Factory with Silverlight and WP7 Unittesting
/src/Ninject.Extensions.Factory/obj/*
/src/Ninject.Extensions.Factory.Test/obj/*
/src/_ReSharper.Ninject.Extensions.Factory/*
Expand Down
Binary file modified lib/Castle-DynamicProxy/net-4.0/Castle.Core.dll
Binary file not shown.
Binary file removed lib/Castle-DynamicProxy/net-4.0/Castle.Core.pdb
Binary file not shown.
611 changes: 572 additions & 39 deletions lib/Castle-DynamicProxy/net-4.0/Castle.Core.xml

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ninject.Extensions.Factory", "Ninject.Extensions.Factory\Ninject.Extensions.Factory.csproj", "{9831975F-FA35-4B8B-A545-1A06852625BB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ninject.Extensions.Factory.Test", "Ninject.Extensions.Factory.Test\Ninject.Extensions.Factory.Test.csproj", "{EB0A05EF-2630-4F8B-92D8-6763509C0D80}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ninject.Extensions.Factory.SilverlightTests", "Ninject.Extensions.Factory.SilverlightTests\Ninject.Extensions.Factory.SilverlightTests.csproj", "{A5862491-AF17-480D-9425-517EE5FFF160}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ninject.Extensions.Factory.WindowsPhone7Tests", "Ninject.Extensions.Factory.WindowsPhone7Tests\Ninject.Extensions.Factory.WindowsPhone7Tests.csproj", "{BECDA738-C474-4D79-AC0F-6CBEEEAD183F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9831975F-FA35-4B8B-A545-1A06852625BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9831975F-FA35-4B8B-A545-1A06852625BB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9831975F-FA35-4B8B-A545-1A06852625BB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9831975F-FA35-4B8B-A545-1A06852625BB}.Release|Any CPU.Build.0 = Release|Any CPU
{EB0A05EF-2630-4F8B-92D8-6763509C0D80}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EB0A05EF-2630-4F8B-92D8-6763509C0D80}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EB0A05EF-2630-4F8B-92D8-6763509C0D80}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EB0A05EF-2630-4F8B-92D8-6763509C0D80}.Release|Any CPU.Build.0 = Release|Any CPU
{A5862491-AF17-480D-9425-517EE5FFF160}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A5862491-AF17-480D-9425-517EE5FFF160}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A5862491-AF17-480D-9425-517EE5FFF160}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A5862491-AF17-480D-9425-517EE5FFF160}.Release|Any CPU.Build.0 = Release|Any CPU
{BECDA738-C474-4D79-AC0F-6CBEEEAD183F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BECDA738-C474-4D79-AC0F-6CBEEEAD183F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BECDA738-C474-4D79-AC0F-6CBEEEAD183F}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{BECDA738-C474-4D79-AC0F-6CBEEEAD183F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BECDA738-C474-4D79-AC0F-6CBEEEAD183F}.Release|Any CPU.Build.0 = Release|Any CPU
{BECDA738-C474-4D79-AC0F-6CBEEEAD183F}.Release|Any CPU.Deploy.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,15 @@
<Compile Include="..\Ninject.Extensions.Factory.Test\Fakes\ICustomizableWeapon.cs">
<Link>Fakes\ICustomizableWeapon.cs</Link>
</Compile>
<Compile Include="..\Ninject.Extensions.Factory.Test\Fakes\IMessageHandler.cs">
<Link>Fakes\IMessageHandler.cs</Link>
</Compile>
<Compile Include="..\Ninject.Extensions.Factory.Test\Fakes\IMessageHandlerFactory.cs">
<Link>Fakes\IMessageHandlerFactory.cs</Link>
</Compile>
<Compile Include="..\Ninject.Extensions.Factory.Test\Fakes\IntMessageHandler.cs">
<Link>Fakes\IntMessageHandler.cs</Link>
</Compile>
<Compile Include="..\Ninject.Extensions.Factory.Test\Fakes\ISpecialWeaponFactory.cs">
<Link>Fakes\ISpecialWeaponFactory.cs</Link>
</Compile>
Expand Down
4 changes: 3 additions & 1 deletion src/Ninject.Extensions.Factory.Test/FuncTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ public void FuncInjectionWithParametersAndConfiguredValues()
const int Width = 34;
const int Length = 123;

this.kernel.Bind<ICustomizableWeapon>().ToConstructor(x => new CustomizableSword(x.Inject<string>(), Width, x.Inject<int>()));
this.kernel.Bind<ICustomizableWeapon>()
.To<CustomizableSword>()
.WithConstructorArgument("width", Width);

var service = this.kernel.Get<ClassWithParameterizedFunc>();
var weapon = service.CreateWeapon(Name, Length);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Castle.Core, Version=2.5.1.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<Reference Include="Castle.Core, Version=3.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<HintPath>..\..\lib\Castle-DynamicProxy\net-4.0\Castle.Core.dll</HintPath>
</Reference>
<Reference Include="FluentAssertions">
Expand Down
18 changes: 18 additions & 0 deletions src/Ninject.Extensions.Factory.WindowsPhone7Tests/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<Application
x:Class="Ninject.Extensions.Factory.WindowsPhone7Tests.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone">

<!--Application Resources-->
<Application.Resources>
</Application.Resources>

<Application.ApplicationLifetimeObjects>
<!--Required object that handles lifetime events for the application-->
<shell:PhoneApplicationService
Launching="Application_Launching" Closing="Application_Closing"
Activated="Application_Activated" Deactivated="Application_Deactivated"/>
</Application.ApplicationLifetimeObjects>
</Application>
81 changes: 81 additions & 0 deletions src/Ninject.Extensions.Factory.WindowsPhone7Tests/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
namespace Ninject.Extensions.Factory.WindowsPhone7Tests
{
using System.Reflection;
using System.Windows;

using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using Xunit.Runner.Silverlight;

public partial class App : Application
{

// Easy access to the root frame
public PhoneApplicationFrame RootFrame { get; private set; }

// Constructor
public App()
{
// Global handler for uncaught exceptions.
// Note that exceptions thrown by ApplicationBarItem.Click will not get caught here.
UnhandledException += Application_UnhandledException;

// Standard Silverlight initialization
InitializeComponent();

// Phone-specific initialization
InitializePhoneApplication();
}

// Code to execute when the application is launching (eg, from Start)
// This code will not execute when the application is reactivated
private void Application_Launching(object sender, LaunchingEventArgs e)
{
}

// Code to execute when the application is activated (brought to foreground)
// This code will not execute when the application is first launched
private void Application_Activated(object sender, ActivatedEventArgs e)
{
}

// Code to execute when the application is deactivated (sent to background)
// This code will not execute when the application is closing
private void Application_Deactivated(object sender, DeactivatedEventArgs e)
{
}

// Code to execute when the application is closing (eg, user hit Back)
// This code will not execute when the application is deactivated
private void Application_Closing(object sender, ClosingEventArgs e)
{
}

// Code to execute on Unhandled Exceptions
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
if (System.Diagnostics.Debugger.IsAttached)
{
// An unhandled exception has occurred; break into the debugger
System.Diagnostics.Debugger.Break();
}
}

#region Phone application initialization

// Avoid double-initialization
private bool phoneApplicationInitialized;

// Do not add any additional code to this method
private void InitializePhoneApplication()
{
if (phoneApplicationInitialized)
return;
phoneApplicationInitialized = true;

this.RootVisual = new TestEngine(Assembly.GetExecutingAssembly());
}

#endregion
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
<?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)' == '' ">AnyCPU</Platform>
<ProductVersion>10.0.20506</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{BECDA738-C474-4D79-AC0F-6CBEEEAD183F}</ProjectGuid>
<ProjectTypeGuids>{C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Ninject.Extensions.Factory.WindowsPhone7Tests</RootNamespace>
<AssemblyName>Ninject.Extensions.Factory.WindowsPhone7Tests</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
<TargetFrameworkProfile>WindowsPhone71</TargetFrameworkProfile>
<TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier>
<SilverlightApplication>true</SilverlightApplication>
<SupportedCultures>
</SupportedCultures>
<XapOutputs>true</XapOutputs>
<GenerateSilverlightManifest>true</GenerateSilverlightManifest>
<XapFilename>Ninject.Extensions.Factory.WindowsPhone7Tests.xap</XapFilename>
<SilverlightManifestTemplate>Properties\AppManifest.xml</SilverlightManifestTemplate>
<SilverlightAppEntry>Ninject.Extensions.Factory.WindowsPhone7Tests.App</SilverlightAppEntry>
<ValidateXaml>true</ValidateXaml>
<ThrowErrorsInValidation>true</ThrowErrorsInValidation>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\build\debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;SILVERLIGHT;WINDOWS_PHONE;NO_MOQ;NO_ASSEMBLY_SCANNING</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<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;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="FluentAssertions.Silverlight">
<HintPath>..\..\tools\FluentAssertions\Silverlight-4.0-wp7\FluentAssertions.Silverlight.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Phone" />
<Reference Include="Microsoft.Phone.Interop" />
<Reference Include="Ninject, Version=2.3.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
<HintPath>..\..\lib\Ninject\silverlight-4.0-wp7\Ninject.dll</HintPath>
</Reference>
<Reference Include="Ninject.Extensions.Factory, Version=2.3.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
<HintPath>..\..\build\silverlight-4.0-wp7\release\Ninject.Extensions.Factory.dll</HintPath>
</Reference>
<Reference Include="System.Windows" />
<Reference Include="system" />
<Reference Include="System.Core" />
<Reference Include="System.Net" />
<Reference Include="System.Xml" />
<Reference Include="xunit-silverlight">
<HintPath>..\..\tools\xunit.sl\Silverlight-4.0-wp7\xunit-silverlight.dll</HintPath>
</Reference>
<Reference Include="xunit.extensions-silverlight">
<HintPath>..\..\tools\xunit.sl\Silverlight-4.0-wp7\xunit.extensions-silverlight.dll</HintPath>
</Reference>
<Reference Include="xunit.runner.silverlight">
<HintPath>..\..\tools\xunit.sl\Silverlight-4.0-wp7\xunit.runner.silverlight.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\Ninject.Extensions.Factory.Test\FactoryTests.cs">
<Link>FactoryTests.cs</Link>
</Compile>
<Compile Include="..\Ninject.Extensions.Factory.Test\Fakes\ClassWithCollectionFunc.cs">
<Link>Fakes\ClassWithCollectionFunc.cs</Link>
</Compile>
<Compile Include="..\Ninject.Extensions.Factory.Test\Fakes\ClassWithFunc.cs">
<Link>Fakes\ClassWithFunc.cs</Link>
</Compile>
<Compile Include="..\Ninject.Extensions.Factory.Test\Fakes\ClassWithLazy.cs">
<Link>Fakes\ClassWithLazy.cs</Link>
</Compile>
<Compile Include="..\Ninject.Extensions.Factory.Test\Fakes\ClassWithParameterizedFunc.cs">
<Link>Fakes\ClassWithParameterizedFunc.cs</Link>
</Compile>
<Compile Include="..\Ninject.Extensions.Factory.Test\Fakes\CustomizableDagger.cs">
<Link>Fakes\CustomizableDagger.cs</Link>
</Compile>
<Compile Include="..\Ninject.Extensions.Factory.Test\Fakes\CustomizableSword.cs">
<Link>Fakes\CustomizableSword.cs</Link>
</Compile>
<Compile Include="..\Ninject.Extensions.Factory.Test\Fakes\Dagger.cs">
<Link>Fakes\Dagger.cs</Link>
</Compile>
<Compile Include="..\Ninject.Extensions.Factory.Test\Fakes\FuncOverloadTestFake.cs">
<Link>Fakes\FuncOverloadTestFake.cs</Link>
</Compile>
<Compile Include="..\Ninject.Extensions.Factory.Test\Fakes\FuncOverloadTestImplementationFake.cs">
<Link>Fakes\FuncOverloadTestImplementationFake.cs</Link>
</Compile>
<Compile Include="..\Ninject.Extensions.Factory.Test\Fakes\ICustomizableWeapon.cs">
<Link>Fakes\ICustomizableWeapon.cs</Link>
</Compile>
<Compile Include="..\Ninject.Extensions.Factory.Test\Fakes\IMessageHandler.cs">
<Link>Fakes\IMessageHandler.cs</Link>
</Compile>
<Compile Include="..\Ninject.Extensions.Factory.Test\Fakes\IMessageHandlerFactory.cs">
<Link>Fakes\IMessageHandlerFactory.cs</Link>
</Compile>
<Compile Include="..\Ninject.Extensions.Factory.Test\Fakes\IntMessageHandler.cs">
<Link>Fakes\IntMessageHandler.cs</Link>
</Compile>
<Compile Include="..\Ninject.Extensions.Factory.Test\Fakes\ISpecialWeaponFactory.cs">
<Link>Fakes\ISpecialWeaponFactory.cs</Link>
</Compile>
<Compile Include="..\Ninject.Extensions.Factory.Test\Fakes\IWeapon.cs">
<Link>Fakes\IWeapon.cs</Link>
</Compile>
<Compile Include="..\Ninject.Extensions.Factory.Test\Fakes\IWeaponFactory.cs">
<Link>Fakes\IWeaponFactory.cs</Link>
</Compile>
<Compile Include="..\Ninject.Extensions.Factory.Test\Fakes\Sword.cs">
<Link>Fakes\Sword.cs</Link>
</Compile>
<Compile Include="..\Ninject.Extensions.Factory.Test\FuncTests.cs">
<Link>FuncTests.cs</Link>
</Compile>
<Compile Include="..\Ninject.Extensions.Factory.Test\UnitTests\ArgumentPositionCalculatorTests.cs">
<Link>UnitTests\ArgumentPositionCalculatorTests.cs</Link>
</Compile>
<Compile Include="..\Ninject.Extensions.Factory.Test\UnitTests\FactoryInterceptorTests.cs">
<Link>UnitTests\FactoryInterceptorTests.cs</Link>
</Compile>
<Compile Include="..\Ninject.Extensions.Factory.Test\UnitTests\FuncConstructorArgumentTests.cs">
<Link>UnitTests\FuncConstructorArgumentTests.cs</Link>
</Compile>
<Compile Include="..\Ninject.Extensions.Factory.Test\UnitTests\FuncProviderTests.cs">
<Link>UnitTests\FuncProviderTests.cs</Link>
</Compile>
<Compile Include="..\Ninject.Extensions.Factory.Test\UnitTests\FunctionFactoryTests.cs">
<Link>UnitTests\FunctionFactoryTests.cs</Link>
</Compile>
<Compile Include="..\Ninject.Extensions.Factory.Test\UnitTests\InstanceResolverTests.cs">
<Link>UnitTests\InstanceResolverTests.cs</Link>
</Compile>
<Compile Include="..\Ninject.Extensions.Factory.Test\UnitTests\IResolutionRootMockExtensions.cs">
<Link>UnitTests\IResolutionRootMockExtensions.cs</Link>
</Compile>
<Compile Include="..\Ninject.Extensions.Factory.Test\UnitTests\ProxyTargetParameterTests.cs">
<Link>UnitTests\ProxyTargetParameterTests.cs</Link>
</Compile>
<Compile Include="..\Ninject.Extensions.Factory.Test\UnitTests\StandardInstanceProviderDefaultImplementationTests.cs">
<Link>UnitTests\StandardInstanceProviderDefaultImplementationTests.cs</Link>
</Compile>
<Compile Include="..\Ninject.Extensions.Factory.Test\UnitTests\StandardInstanceProviderTests.cs">
<Link>UnitTests\StandardInstanceProviderTests.cs</Link>
</Compile>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</ApplicationDefinition>
</ItemGroup>
<ItemGroup>
<None Include="Properties\AppManifest.xml" />
<None Include="Properties\WMAppManifest.xml" />
</ItemGroup>
<ItemGroup>
<Content Include="ApplicationIcon.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Background.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="SplashScreenImage.jpg" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.$(TargetFrameworkProfile).Overrides.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.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>
-->
<ProjectExtensions />
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<Deployment.Parts>
</Deployment.Parts>
</Deployment>
Loading

0 comments on commit 89750a8

Please sign in to comment.