Skip to content

Commit

Permalink
Moved RepositoryTestsHelper.cs from SharpArch.Testing.NUnit/MbUnit.NH…
Browse files Browse the repository at this point in the history
…iberate to SharpArch.Testing.NHibernate to fix http://code.google.com/p/sharp-architecture/issues/detail?id=100
  • Loading branch information
wmccafferty committed Jun 17, 2009
1 parent 0bc1993 commit a5d169d
Show file tree
Hide file tree
Showing 31 changed files with 47 additions and 120 deletions.
9 changes: 7 additions & 2 deletions VersionHistory.txt
Expand Up @@ -39,18 +39,22 @@ Assembly Dependencies:

Required Upgrade Steps

Upgrading to S#arp Architecture 1.0 RTM from RC 2 requires a few steps to accommodate upgraded dependencies (steps also reflected in the Northwind sample project and VS generated projects). Each of the following steps is prefixed with the dependency that that the upgrade step is associated with:
Upgrading to S#arp Architecture 1.0 RTM from RC 2 requires a few steps to accommodate upgraded dependencies (steps also reflected in the Northwind sample project and VS generated projects). For reference, each of the following steps is prefixed with the dependency that that the upgrade step is associated with:

#) ASP.NET MVC: If you have any previous versions of ASP.NET MVC installed, you must uninstall them and optionally may install ASP.NET MVC 1.0

#) NUnit: Install NUnit 2.5 using the installer found within /tools (optionally uninstalling previous versions)

#) NUnit: Drop any usings of "using NUnit.Framework.SyntaxHelpers;" - this namespace no longer exists and has been merged into the NUnit.Framework namespace

#) NUnit: Change any use of ExpectedException attributes to use Assert.Throws instead; see http://mint.litemedia.se/2009/05/30/new-expectedexception-model-in-nunit-25/ for details

#) T4 Toolbox: Uninstall any previous version of T4 Toolbox and install T4 Toolbox 9.5 (installer found in /tools)

#) SharpArch: To easily update all the assembly references in your existing project, create a new project using the S#arp Architecture VS project template and copy the assemblies from /lib and /tools/lib to your project's respective folders (You could also copy them from the trunk's /bin folder, but using a generated project is simpler.)

#) SharpArch: Within YourProject.Tests/YourProject.Data/NHibernateMaps/MappingIntegrationTests.cs, add a reference to "using SharpArch.Testing.NHibernate;" to accommodate the move of RepositoryTestsHelper to the new namespace.

#) SharpArch: Upgrade YourProject.Tests/YourProject.Data/NHibernateMaps/MappingIntegrationTests.cs to accommodate the changes that were made to support multiple databases (if not done, you will likely have breaking unit tests). To do so, compare your MappingIntegrationTests.cs to the one at http://sharp-architecture.googlecode.com/svn/trunk/src/NorthwindSample/tests/Northwind.Tests/Northwind.Data/NHibernateMaps/MappingIntegrationTests.cs. The necessary change is the introduction of the session factory key.

#) SharpArch: Within YourProject.Web/Global.asax.cs, migrate the call to NHibernateSession.Init() from the Global.asax.cs class' Init() method to its Application_BeginRequest() method using the following as an example: http://sharp-architecture.googlecode.com/svn/trunk/src/NorthwindSample/app/Northwind.Web/Global.asax.cs
Expand Down Expand Up @@ -149,8 +153,9 @@ SharpArch.Data:
* /NHibernate/Repository.cs: Added factory key lookup for support of multiple databases. Also now passing factory key to DB context, accordingly.
* /NHibernate/SessionFactoryAttribute.cs: Introduced this attribute to be used on repositories to designate which session factory its associated with. It does not need to be used for single database scenarios or for your "default" database.

SharpArch.Testing.NUnit:
SharpArch.Testing.NUnit/MbUnit:
* /NHibernate/RepositoryTestsHelper.cs: Dropped the previously 4th parameter, a bool for formatting, to support the modified signature of NHibernate's SchemaExport.Execute()
* BREAKING CHANGE ~ /NHibernate/RepositoryTestsHelper.cs: Moved this helper class to SharpArch.Testing.NHibernate as it does not have dependencies on NUnit nor on MbUnit

SharpArch.Wcf:
* Added this class library to support WCF. WCF does NOT currently support multiple databases.
Expand Down
Binary file modified bin/SharpArch.Core.NHibernateValidator.dll
Binary file not shown.
Binary file modified bin/SharpArch.Core.NHibernateValidator.pdb
Binary file not shown.
Binary file modified bin/SharpArch.Core.dll
Binary file not shown.
Binary file modified bin/SharpArch.Core.pdb
Binary file not shown.
Binary file modified bin/SharpArch.Data.dll
Binary file not shown.
Binary file modified bin/SharpArch.Data.pdb
Binary file not shown.
Binary file modified bin/SharpArch.Testing.NUnit.dll
Binary file not shown.
Binary file modified bin/SharpArch.Testing.NUnit.pdb
Binary file not shown.
Binary file modified bin/SharpArch.Testing.dll
Binary file not shown.
Binary file modified bin/SharpArch.Testing.pdb
Binary file not shown.
Binary file modified bin/SharpArch.Wcf.dll
Binary file not shown.
Binary file modified bin/SharpArch.Wcf.pdb
Binary file not shown.
Binary file modified bin/SharpArch.WcfClient.Castle.dll
Binary file not shown.
Binary file modified bin/SharpArch.WcfClient.Castle.pdb
Binary file not shown.
Binary file modified bin/SharpArch.Web.Castle.dll
Binary file not shown.
Binary file modified bin/SharpArch.Web.Castle.pdb
Binary file not shown.
Binary file modified bin/SharpArch.Web.dll
Binary file not shown.
Binary file modified bin/SharpArch.Web.pdb
Binary file not shown.
Expand Up @@ -7,6 +7,7 @@
using System;
using System.Collections.Generic;
using NHibernate.Metadata;
using SharpArch.Testing.NHibernate;

namespace Tests.Northwind.Data.NHibernateMaps
{
Expand Down
@@ -1,5 +1,6 @@
using MbUnit.Framework;
using SharpArch.Data.NHibernate;
using SharpArch.Testing.NHibernate;

namespace SharpArch.Testing.MbUnit.NHibernate
{
Expand All @@ -18,17 +19,15 @@ namespace SharpArch.Testing.MbUnit.NHibernate
public abstract class DatabaseRepositoryTestsBase
{
[SetUp]
public virtual void SetUp( )
{
RepositoryTestsHelper.InitializeNHibernateSession( );
NHibernateSession.Current.BeginTransaction( );
public virtual void SetUp() {
RepositoryTestsHelper.InitializeNHibernateSession();
NHibernateSession.Current.BeginTransaction();
}

[TearDown]
public virtual void TearDown( )
{
NHibernateSession.Current.Transaction.Rollback( );
NHibernateSession.Storage.Session.Dispose( );
public virtual void TearDown() {
NHibernateSession.Current.Transaction.Rollback();
NHibernateSession.Storage.Session.Dispose();
}
}
}
@@ -1,5 +1,6 @@
using MbUnit.Framework;
using SharpArch.Data.NHibernate;
using SharpArch.Testing.NHibernate;

namespace SharpArch.Testing.MbUnit.NHibernate
{
Expand Down
@@ -1,5 +1,6 @@
using MbUnit.Framework;
using SharpArch.Data.NHibernate;
using SharpArch.Testing.NHibernate;

namespace SharpArch.Testing.MbUnit.NHibernate
{
Expand Down

This file was deleted.

Expand Up @@ -71,7 +71,6 @@
<Compile Include="NHibernate\DatabaseRepositoryTestsBase.cs" />
<Compile Include="NHibernate\RepositoryBehaviorSpecificationTestsBase.cs" />
<Compile Include="NHibernate\RepositoryTestsBase.cs" />
<Compile Include="NHibernate\RepositoryTestsHelper.cs" />
</ItemGroup>
<ItemGroup>
<None Include="SharpArch.snk" />
Expand All @@ -85,6 +84,10 @@
<Project>{FD9CF06F-A44D-494C-AC23-AE278F9268B6}</Project>
<Name>SharpArch.Data</Name>
</ProjectReference>
<ProjectReference Include="..\SharpArch.Testing\SharpArch.Testing.csproj">
<Project>{230DF364-CC54-440A-AA02-31A0E2964AC3}</Project>
<Name>SharpArch.Testing</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
Expand Down
@@ -1,13 +1,6 @@
using FluentNHibernate.AutoMap;
using SharpArch.Data.NHibernate;
using NUnit.Framework;
using System.Configuration;
using System.IO;
using NHibernate.Cfg;
using System.Collections.Specialized;
using SharpArch.Core;
using FluentNHibernate;
using System.Reflection;
using SharpArch.Data.NHibernate;
using SharpArch.Testing.NHibernate;

namespace SharpArch.Testing.NUnit.NHibernate
{
Expand Down
@@ -1,12 +1,6 @@
using FluentNHibernate;
using NHibernate.Cfg;
using NHibernate.Tool.hbm2ddl;
using SharpArch.Data.NHibernate;
using NUnit.Framework;
using SharpArch.Core;
using System;
using SharpArch.Data.NHibernate;
using System.Configuration;
using System.Data;
using SharpArch.Testing.NHibernate;

namespace SharpArch.Testing.NUnit.NHibernate
{
Expand Down
@@ -1,11 +1,6 @@
using FluentNHibernate;
using NHibernate.Cfg;
using NHibernate.Tool.hbm2ddl;
using SharpArch.Data.NHibernate;
using NUnit.Framework;
using SharpArch.Core;
using System.Configuration;
using SharpArch.Data.NHibernate;
using System.Data;
using SharpArch.Testing.NHibernate;

namespace SharpArch.Testing.NUnit.NHibernate
{
Expand Down
Expand Up @@ -59,7 +59,6 @@
<Compile Include="NHibernate\RepositoryTestsBase.cs" />
<Compile Include="NHibernate\RepositoryBehaviorSpecificationTestsBase.cs" />
<Compile Include="NHibernate\DatabaseRepositoryTestsBase.cs" />
<Compile Include="NHibernate\RepositoryTestsHelper.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SyntaxHelpers.cs" />
</ItemGroup>
Expand All @@ -72,6 +71,10 @@
<Project>{FD9CF06F-A44D-494C-AC23-AE278F9268B6}</Project>
<Name>SharpArch.Data</Name>
</ProjectReference>
<ProjectReference Include="..\SharpArch.Testing\SharpArch.Testing.csproj">
<Project>{230DF364-CC54-440A-AA02-31A0E2964AC3}</Project>
<Name>SharpArch.Testing</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="SharpArch.snk" />
Expand Down
@@ -1,16 +1,16 @@
using System;
using System.Configuration;
using System.Reflection;
using FluentNHibernate.AutoMap;
using SharpArch.Core;
using NHibernate.Cfg;
using System.Data;
using NHibernate;
using NHibernate.Tool.hbm2ddl;
using SharpArch.Core;
using SharpArch.Data.NHibernate;
using System.Configuration;
using SharpArch.Data.NHibernate.FluentNHibernate;
using NHibernate;
using Configuration = NHibernate.Cfg.Configuration;
using System.Data;

namespace SharpArch.Testing.NUnit.NHibernate
namespace SharpArch.Testing.NHibernate
{
/// <summary>
/// Provides helper methods for consolidating duplicated code from test fixture base classes.
Expand All @@ -37,7 +37,7 @@ public class RepositoryTestsHelper
}

public static string[] GetMappingAssemblies() {
string mappingAssembliesSetting = ConfigurationSettings.AppSettings["nhibernate.mapping.assembly"];
string mappingAssembliesSetting = ConfigurationManager.AppSettings["nhibernate.mapping.assembly"];

Check.Require(!string.IsNullOrEmpty(mappingAssembliesSetting),
"Please add an AppSetting to your app.config for 'nhibernate.mapping.assembly.' This setting " +
Expand Down Expand Up @@ -66,4 +66,4 @@ public class RepositoryTestsHelper
private static Configuration cfg;
private static ISessionFactory sessionFactory;
}
}
}
8 changes: 8 additions & 0 deletions src/SharpArch/SharpArch.Testing/SharpArch.Testing.csproj
Expand Up @@ -33,7 +33,10 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="FluentNHibernate, Version=0.1.0.0, Culture=neutral, PublicKeyToken=8aa435e3cb308880, processorArchitecture=MSIL" />
<Reference Include="NHibernate, Version=2.1.0.2001, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL" />
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
Expand All @@ -45,13 +48,18 @@
<Link>Properties\CommonAssemblyInfo.cs</Link>
</Compile>
<Compile Include="EntityIdSetter.cs" />
<Compile Include="NHibernate\RepositoryTestsHelper.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SharpArch.Core\SharpArch.Core.csproj">
<Project>{E12E99BB-8732-441F-B3A6-861F0CE23D3D}</Project>
<Name>SharpArch.Core</Name>
</ProjectReference>
<ProjectReference Include="..\SharpArch.Data\SharpArch.Data.csproj">
<Project>{FD9CF06F-A44D-494C-AC23-AE278F9268B6}</Project>
<Name>SharpArch.Data</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="SharpArch.snk" />
Expand Down

0 comments on commit a5d169d

Please sign in to comment.