From: <fli...@us...> - 2008-12-19 15:18:03
|
Revision: 201 http://structuremap.svn.sourceforge.net/structuremap/?rev=201&view=rev Author: flimflan Date: 2008-12-19 15:17:56 +0000 (Fri, 19 Dec 2008) Log Message: ----------- Added missing DebuggerVisualizers test project Added Paths: ----------- trunk/Source/StructureMap.DebuggerVisualizers.Testing/ trunk/Source/StructureMap.DebuggerVisualizers.Testing/Program.cs trunk/Source/StructureMap.DebuggerVisualizers.Testing/Properties/ trunk/Source/StructureMap.DebuggerVisualizers.Testing/Properties/AssemblyInfo.cs trunk/Source/StructureMap.DebuggerVisualizers.Testing/SampleTypes.cs trunk/Source/StructureMap.DebuggerVisualizers.Testing/StructureMap.DebuggerVisualizers.Testing.csproj trunk/Source/StructureMap.DebuggerVisualizers.Testing/VisualizerTests.cs Property changes on: trunk/Source/StructureMap.DebuggerVisualizers.Testing ___________________________________________________________________ Added: svn:ignore + bin obj Added: trunk/Source/StructureMap.DebuggerVisualizers.Testing/Program.cs =================================================================== --- trunk/Source/StructureMap.DebuggerVisualizers.Testing/Program.cs (rev 0) +++ trunk/Source/StructureMap.DebuggerVisualizers.Testing/Program.cs 2008-12-19 15:17:56 UTC (rev 201) @@ -0,0 +1,32 @@ +using System.Diagnostics; +using System.Windows.Forms; + +namespace StructureMap.DebuggerVisualizers.Testing +{ + class Program + { + static void Main(string[] args) + { + var container = new Container( x => + { + x.Scan(s => + { + s.TheCallingAssembly(); + s.WithDefaultConventions(); + }); + x.ForRequestedType<IDoMore<string>>().TheDefaultIsConcreteType<DoForStrings>(); + x.ForRequestedType<IDoThat>().AddInstances(i => + { + i.OfConcreteType<DoThat>().WithName("Red"); + i.OfConcreteType<DoThat>().WithName("Blue"); + }); + }); + + ObjectFactory.Initialize(i => i.ForRequestedType<IDoThat>().TheDefaultIsConcreteType<DoThat>()); + Debug.WriteLine(container.WhatDoIHave()); + + var details = ContainerVisualizerObjectSource.BuildContainerDetails(container); + Application.Run(new ContainerForm(details)); + } + } +} \ No newline at end of file Added: trunk/Source/StructureMap.DebuggerVisualizers.Testing/Properties/AssemblyInfo.cs =================================================================== --- trunk/Source/StructureMap.DebuggerVisualizers.Testing/Properties/AssemblyInfo.cs (rev 0) +++ trunk/Source/StructureMap.DebuggerVisualizers.Testing/Properties/AssemblyInfo.cs 2008-12-19 15:17:56 UTC (rev 201) @@ -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("StructureMap.DebuggerVisualizers.Runner")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("StructureMap.DebuggerVisualizers.Runner")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2008")] +[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("d5786571-ba46-4985-a1a7-7360d8d3190e")] + +// 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")] Added: trunk/Source/StructureMap.DebuggerVisualizers.Testing/SampleTypes.cs =================================================================== --- trunk/Source/StructureMap.DebuggerVisualizers.Testing/SampleTypes.cs (rev 0) +++ trunk/Source/StructureMap.DebuggerVisualizers.Testing/SampleTypes.cs 2008-12-19 15:17:56 UTC (rev 201) @@ -0,0 +1,63 @@ +namespace StructureMap.DebuggerVisualizers.Testing +{ + public interface IDoThis + { + void Do(); + } + + public interface IDoThat + { + void DoIt(); + } + + public interface IDoMore<T> + { + void DoDo(T thing); + } + + public interface IHasTwoGenerics<FIRST, SECOND> + { + SECOND DoIt(FIRST input); + } + + public class DoThis : IDoThis + { + public void Do() + { + + } + } + + public class DoThat : IDoThat + { + public void DoIt() + { + + } + } + + public class DoMore<T> :IDoMore<T> + { + public void DoDo(T thing) + { + + } + } + + public class HasTwoGenerics<FIRST, SECOND> : IHasTwoGenerics<FIRST, SECOND> + { + public SECOND DoIt(FIRST input) + { + throw new System.NotImplementedException(); + } + } + + public class DoForStrings :IDoMore<string> + { + public void DoDo(string thing) + { + + + } + } +} \ No newline at end of file Added: trunk/Source/StructureMap.DebuggerVisualizers.Testing/StructureMap.DebuggerVisualizers.Testing.csproj =================================================================== --- trunk/Source/StructureMap.DebuggerVisualizers.Testing/StructureMap.DebuggerVisualizers.Testing.csproj (rev 0) +++ trunk/Source/StructureMap.DebuggerVisualizers.Testing/StructureMap.DebuggerVisualizers.Testing.csproj 2008-12-19 15:17:56 UTC (rev 201) @@ -0,0 +1,71 @@ +<?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.21022</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{13C368E6-A7BE-46E8-8CFB-64010C825748}</ProjectGuid> + <OutputType>WinExe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>StructureMap.DebuggerVisualizers.Testing</RootNamespace> + <AssemblyName>StructureMap.DebuggerVisualizers.Testing</AssemblyName> + <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <StartupObject> + </StartupObject> + </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="Microsoft.VisualStudio.DebuggerVisualizers, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" /> + <Reference Include="nunit.framework, Version=2.4.0.2, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\bin\NUnit\nunit.framework.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Core"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> + <Reference Include="System.Windows.Forms" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Program.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="SampleTypes.cs" /> + <Compile Include="VisualizerTests.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\StructureMap.DebuggerVisualizers\StructureMap.DebuggerVisualizers.csproj"> + <Project>{F023DA4D-0B7D-4836-A56A-21F22A0A2D71}</Project> + <Name>StructureMap.DebuggerVisualizers</Name> + </ProjectReference> + <ProjectReference Include="..\StructureMap\StructureMap.csproj"> + <Project>{3F36EA80-2F9A-4DAD-BA27-5AC6163A2EE3}</Project> + <Name>StructureMap</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> \ No newline at end of file Added: trunk/Source/StructureMap.DebuggerVisualizers.Testing/VisualizerTests.cs =================================================================== --- trunk/Source/StructureMap.DebuggerVisualizers.Testing/VisualizerTests.cs (rev 0) +++ trunk/Source/StructureMap.DebuggerVisualizers.Testing/VisualizerTests.cs 2008-12-19 15:17:56 UTC (rev 201) @@ -0,0 +1,58 @@ +using System.IO; +using System.Runtime.Serialization.Formatters.Binary; +using NUnit.Framework; +using NUnit.Framework.SyntaxHelpers; +using StructureMap.Pipeline; + +namespace StructureMap.DebuggerVisualizers.Testing +{ + [TestFixture] + public class VisualizerTests + { + [Test] + public void can_serialize_container_details() + { + var pluginTypeDetails = new[]{ new PluginTypeDetail(typeof(string), typeof(BuildPolicy), new[]{ new InstanceDetail("First", "First Instance", typeof(string)), }) }; + var wrapper = new ContainerDetail(new[]{"config"}, pluginTypeDetails); + var binaryFormatter = new BinaryFormatter(); + Stream stream = new MemoryStream(); + binaryFormatter.Serialize(stream, wrapper); + + stream.Position = 0; + var detailOnOtherSide = (ContainerDetail) binaryFormatter.Deserialize(stream); + Assert.That(detailOnOtherSide, Is.Not.Null); + Assert.That(detailOnOtherSide, Is.TypeOf(typeof(ContainerDetail))); + } + + [Test] + public void display_nongeneric_types() + { + Assert.That( typeof(IDoThat).AsCSharp(), Is.EqualTo("IDoThat")); + } + + [Test] + public void display_open_generics_using_c_sharp_syntax() + { + Assert.That(typeof (IHasTwoGenerics<,>).AsCSharp(), Is.EqualTo("IHasTwoGenerics<FIRST,SECOND>")); + } + + [Test] + public void display_closed_generics_using_c_sharp_syntax() + { + Assert.That(typeof(IHasTwoGenerics<string, int>).AsCSharp(), Is.EqualTo("IHasTwoGenerics<String,Int32>")); + } + + [Test] + public void display_open_generics_using_c_sharp_syntax_with_fullnames() + { + Assert.That(typeof(IHasTwoGenerics<,>).AsCSharp(t => t.FullName), Is.EqualTo("StructureMap.DebuggerVisualizers.Testing.IHasTwoGenerics<FIRST,SECOND>")); + } + + [Test] + public void display_closed_generics_using_c_sharp_syntax_with_fullnames() + { + Assert.That(typeof(IHasTwoGenerics<string, int>).AsCSharp(t => t.FullName), Is.EqualTo("StructureMap.DebuggerVisualizers.Testing.IHasTwoGenerics<System.String,System.Int32>")); + } + + } +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |