Permalink
Browse files

Removed files in Properties folder, fixed the dialog tests that was s…

…kipped
  • Loading branch information...
1 parent cc63229 commit e7b010930318213bc2bfbd7271c12adedf7a81fc @HEskandari HEskandari committed Aug 28, 2010
@@ -1,124 +1,125 @@
-<?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>8.0.30703</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{0E53928C-3A33-4C4A-8B8C-ABA257B0E94E}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Rhino.Licensing.AdminTool.Tests</RootNamespace>
- <AssemblyName>Rhino.Licensing.AdminTool.Tests</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="Caliburn.Core">
- <HintPath>..\SharedLibs\Caliburn.Core.dll</HintPath>
- </Reference>
- <Reference Include="Caliburn.DynamicProxy">
- <HintPath>..\SharedLibs\Caliburn.DynamicProxy.dll</HintPath>
- </Reference>
- <Reference Include="Caliburn.FluentValidation">
- <HintPath>..\SharedLibs\Caliburn.FluentValidation.dll</HintPath>
- </Reference>
- <Reference Include="Caliburn.PresentationFramework">
- <HintPath>..\SharedLibs\Caliburn.PresentationFramework.dll</HintPath>
- </Reference>
- <Reference Include="Caliburn.ShellFramework">
- <HintPath>..\SharedLibs\Caliburn.ShellFramework.dll</HintPath>
- </Reference>
- <Reference Include="Caliburn.Testability">
- <HintPath>..\SharedLibs\Caliburn.Testability.dll</HintPath>
- </Reference>
- <Reference Include="Caliburn.Windsor">
- <HintPath>..\SharedLibs\Caliburn.Windsor.dll</HintPath>
- </Reference>
- <Reference Include="Castle.Core">
- <HintPath>..\SharedLibs\Castle.Core.dll</HintPath>
- </Reference>
- <Reference Include="Castle.DynamicProxy2">
- <HintPath>..\SharedLibs\Castle.DynamicProxy2.dll</HintPath>
- </Reference>
- <Reference Include="Castle.MicroKernel">
- <HintPath>..\SharedLibs\Castle.MicroKernel.dll</HintPath>
- </Reference>
- <Reference Include="Castle.Windsor">
- <HintPath>..\SharedLibs\Castle.Windsor.dll</HintPath>
- </Reference>
- <Reference Include="log4net">
- <HintPath>..\SharedLibs\log4net.dll</HintPath>
- </Reference>
- <Reference Include="Microsoft.Practices.ServiceLocation">
- <HintPath>..\SharedLibs\Microsoft.Practices.ServiceLocation.dll</HintPath>
- </Reference>
- <Reference Include="PresentationCore" />
- <Reference Include="PresentationFramework" />
- <Reference Include="Rhino.Mocks">
- <HintPath>..\SharedLibs\Rhino.Mocks.dll</HintPath>
- </Reference>
- <Reference Include="System" />
- <Reference Include="System.Core" />
- <Reference Include="System.Windows.Forms" />
- <Reference Include="System.Xml.Linq" />
- <Reference Include="System.Data.DataSetExtensions" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- <Reference Include="WindowsBase" />
- <Reference Include="xunit, Version=1.5.0.1479, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\SharedLibs\xunit.dll</HintPath>
- </Reference>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Dialogs\FileDialogTests.cs" />
- <Compile Include="Dialogs\OpenFileDialogTests.cs" />
- <Compile Include="Dialogs\SaveFileDialogTests.cs" />
- <Compile Include="GuyWireTests.cs" />
- <Compile Include="Models\ProductModelTests.cs" />
- <Compile Include="Models\ProjectModelTests.cs" />
- <Compile Include="Services\DialogServiceTests.cs" />
- <Compile Include="Services\ProjectServiceTests.cs" />
- <Compile Include="ViewModels\AboutViewModelTests.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="ViewModels\DialogViewModelTests.cs" />
- <Compile Include="ViewModels\ProjectViewModelTests.cs" />
- <Compile Include="ViewModels\ShellViewModelTests.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\Rhino.Licensing.AdminTool\Rhino.Licensing.AdminTool.csproj">
- <Project>{9C11E95F-82A2-4A40-8E15-33487A64F7D2}</Project>
- <Name>Rhino.Licensing.AdminTool</Name>
- </ProjectReference>
- <ProjectReference Include="..\Rhino.Licensing\Rhino.Licensing.csproj">
- <Project>{05EFD7EB-F0FB-4B65-8E4A-C8FF8DDC6A78}</Project>
- <Name>Rhino.Licensing</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+<?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>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{0E53928C-3A33-4C4A-8B8C-ABA257B0E94E}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Rhino.Licensing.AdminTool.Tests</RootNamespace>
+ <AssemblyName>Rhino.Licensing.AdminTool.Tests</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="Caliburn.Core">
+ <HintPath>..\SharedLibs\Caliburn.Core.dll</HintPath>
+ </Reference>
+ <Reference Include="Caliburn.DynamicProxy">
+ <HintPath>..\SharedLibs\Caliburn.DynamicProxy.dll</HintPath>
+ </Reference>
+ <Reference Include="Caliburn.FluentValidation">
+ <HintPath>..\SharedLibs\Caliburn.FluentValidation.dll</HintPath>
+ </Reference>
+ <Reference Include="Caliburn.PresentationFramework">
+ <HintPath>..\SharedLibs\Caliburn.PresentationFramework.dll</HintPath>
+ </Reference>
+ <Reference Include="Caliburn.ShellFramework">
+ <HintPath>..\SharedLibs\Caliburn.ShellFramework.dll</HintPath>
+ </Reference>
+ <Reference Include="Caliburn.Testability">
+ <HintPath>..\SharedLibs\Caliburn.Testability.dll</HintPath>
+ </Reference>
+ <Reference Include="Caliburn.Windsor">
+ <HintPath>..\SharedLibs\Caliburn.Windsor.dll</HintPath>
+ </Reference>
+ <Reference Include="Castle.Core">
+ <HintPath>..\SharedLibs\Castle.Core.dll</HintPath>
+ </Reference>
+ <Reference Include="Castle.DynamicProxy2">
+ <HintPath>..\SharedLibs\Castle.DynamicProxy2.dll</HintPath>
+ </Reference>
+ <Reference Include="Castle.MicroKernel">
+ <HintPath>..\SharedLibs\Castle.MicroKernel.dll</HintPath>
+ </Reference>
+ <Reference Include="Castle.Windsor">
+ <HintPath>..\SharedLibs\Castle.Windsor.dll</HintPath>
+ </Reference>
+ <Reference Include="log4net">
+ <HintPath>..\SharedLibs\log4net.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.Practices.ServiceLocation">
+ <HintPath>..\SharedLibs\Microsoft.Practices.ServiceLocation.dll</HintPath>
+ </Reference>
+ <Reference Include="PresentationCore" />
+ <Reference Include="PresentationFramework" />
+ <Reference Include="Rhino.Mocks">
+ <HintPath>..\SharedLibs\Rhino.Mocks.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Windows.Forms" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ <Reference Include="WindowsBase" />
+ <Reference Include="xunit, Version=1.5.0.1479, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\SharedLibs\xunit.dll</HintPath>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Dialogs\FileDialogTests.cs" />
+ <Compile Include="Dialogs\OpenFileDialogTests.cs" />
+ <Compile Include="Dialogs\SaveFileDialogTests.cs" />
+ <Compile Include="Startup\ContainerTests.cs" />
+ <Compile Include="Startup\GuyWireTests.cs" />
+ <Compile Include="Models\ProductModelTests.cs" />
+ <Compile Include="Models\ProjectModelTests.cs" />
+ <Compile Include="Services\DialogServiceTests.cs" />
+ <Compile Include="Services\ProjectServiceTests.cs" />
+ <Compile Include="ViewModels\AboutViewModelTests.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="ViewModels\DialogViewModelTests.cs" />
+ <Compile Include="ViewModels\ProjectViewModelTests.cs" />
+ <Compile Include="ViewModels\ShellViewModelTests.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\Rhino.Licensing.AdminTool\Rhino.Licensing.AdminTool.csproj">
+ <Project>{9C11E95F-82A2-4A40-8E15-33487A64F7D2}</Project>
+ <Name>Rhino.Licensing.AdminTool</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\Rhino.Licensing\Rhino.Licensing.csproj">
+ <Project>{05EFD7EB-F0FB-4B65-8E4A-C8FF8DDC6A78}</Project>
+ <Name>Rhino.Licensing</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>
@@ -11,23 +11,23 @@ namespace Rhino.Licensing.AdminTool.Tests.Services
{
public class DialogServiceTests
{
- [Fact(Skip = "Not Completed")]
+ [Fact]
public void Can_Show_OpenFileDialog()
{
var model = CreateOpenFileDialogModel();
var factory = MockRepository.GenerateMock<IDialogFactory>();
var dialog = MockRepository.GenerateMock<OpenFileDialog>(model);
- factory.Expect(x => x.Create<OpenFileDialog>(Arg.Is(model))).Return(dialog);
- dialog.Expect(x => x.ShowDialog()).Return(DialogResult.OK);
+ factory.Expect(x => x.Create<OpenFileDialog>(Arg.Is(model))).Return(dialog);
dialog.Expect(x => x.ViewModel).Return(model);
+ dialog.Expect(x => x.ShowDialog()).Return(DialogResult.OK);
new DialogService(factory).ShowOpenFileDialog(model);
dialog.AssertWasCalled(x => x.ShowDialog(), x => x.Repeat.Once());
}
- [Fact(Skip = "Not Completed")]
+ [Fact]
public void Can_Show_SaveFileDialog()
{
var model = CreateSaveFileDialogModel();
@@ -43,6 +43,56 @@ public void Can_Show_SaveFileDialog()
dialog.AssertWasCalled(x => x.ShowDialog(), x => x.Repeat.Once());
}
+ [Fact]
+ public void Returning_OK_As_DialogResult_Translates_To_True()
+ {
+ var model = CreateOpenFileDialogModel();
+ var factory = MockRepository.GenerateMock<IDialogFactory>();
+ var dialog = MockRepository.GenerateMock<OpenFileDialog>(model);
+
+ factory.Expect(x => x.Create<OpenFileDialog>(Arg.Is(model))).Return(dialog);
+ dialog.Expect(x => x.ViewModel).Return(model);
+ dialog.Expect(x => x.ShowDialog()).Return(DialogResult.OK);
+
+ var result = new DialogService(factory).ShowOpenFileDialog(model);
+
+ Assert.NotNull(result);
+ Assert.True(result.Value);
+ }
+
+ [Fact]
+ public void Returning_Cancel_As_DialogResult_Translates_To_False()
+ {
+ var model = CreateOpenFileDialogModel();
+ var factory = MockRepository.GenerateMock<IDialogFactory>();
+ var dialog = MockRepository.GenerateMock<OpenFileDialog>(model);
+
+ factory.Expect(x => x.Create<OpenFileDialog>(Arg.Is(model))).Return(dialog);
+ dialog.Expect(x => x.ViewModel).Return(model);
+ dialog.Expect(x => x.ShowDialog()).Return(DialogResult.Cancel);
+
+ var result = new DialogService(factory).ShowOpenFileDialog(model);
+
+ Assert.NotNull(result);
+ Assert.False(result.Value);
+ }
+
+ [Fact]
+ public void Returning_Anything_Else_From_DialogResult_Translates_To_Null()
+ {
+ var model = CreateOpenFileDialogModel();
+ var factory = MockRepository.GenerateMock<IDialogFactory>();
+ var dialog = MockRepository.GenerateMock<OpenFileDialog>(model);
+
+ factory.Expect(x => x.Create<OpenFileDialog>(Arg.Is(model))).Return(dialog);
+ dialog.Expect(x => x.ViewModel).Return(model);
+ dialog.Expect(x => x.ShowDialog()).Return(DialogResult.Abort);
+
+ var result = new DialogService(factory).ShowOpenFileDialog(model);
+
+ Assert.Null(result);
+ }
+
private IOpenFileDialogViewModel CreateOpenFileDialogModel()
{
return new OpenFileDialogViewModel
@@ -0,0 +1,45 @@
+using System;
+using System.Collections.Generic;
+using Castle.MicroKernel;
+using Castle.MicroKernel.Registration;
+using Castle.Windsor;
+using Xunit;
+using Rhino.Licensing.AdminTool.Extensions;
+
+namespace Rhino.Licensing.AdminTool.Tests.Startup
+{
+ public class ContainerTests
+ {
+ [Fact]
+ public void Registering_With_FirstInterfaceOnClass()
+ {
+ var container = new WindsorContainer();
+
+ container.Register(AllTypes.Pick(TypesToRegister)
+ .Where(t => t != null /*Any Predicate*/)
+ .WithService.FirstInterfaceOnClass());
+
+ var component = container.Resolve<IFirst>();
+
+ Assert.NotNull(component);
+ Assert.Throws<ComponentNotFoundException>(() => container.Resolve<ISecond>());
+ }
+
+ private IEnumerable<Type> TypesToRegister
+ {
+ get { return new[] {typeof (ComponentToRegister)}; }
+ }
+
+ private interface IFirst
+ {
+ }
+
+ private interface ISecond
+ {
+ }
+
+ private class ComponentToRegister : IFirst, ISecond
+ {
+ }
+ }
+}
Oops, something went wrong.

0 comments on commit e7b0109

Please sign in to comment.