protected void VerifyCanCreateUnitOfWorkContextFor(PersistenceFramework framework, string rhinoContainerPath, DatabaseEngine databaseEngine, string databaseName) { int nextContextPosition = Contexts.Count; //creates the UnitOfWorkContext MappingInfo mappingInfo = MappingInfo.FromAssemblyContaining <AREntity>(); InitializeNHibernateAndIoC(framework, rhinoContainerPath, databaseEngine, databaseName, mappingInfo); UnitOfWorkTestContext context = Contexts[nextContextPosition]; Assert.AreEqual(framework, context.Framework); if (rhinoContainerPath != null) { Assert.AreEqual(rhinoContainerPath, context.RhinoContainerConfigPath); } else { Assert.IsEmpty(context.RhinoContainerConfigPath); } Assert.AreEqual(databaseEngine, context.DatabaseEngine); if (string.IsNullOrEmpty(databaseName)) { Assert.AreEqual( NHibernateInitializer.DeriveDatabaseNameFrom(databaseEngine, mappingInfo.MappingAssemblies[0]), context.DatabaseName); } else { Assert.AreEqual(databaseName, context.DatabaseName); } Assert.AreEqual(CurrentContext, context, "Context just built has been assigned to CurrentContext"); }
protected void VerifyCanCreateUnitOfWorkContextFor(string containerPath, DatabaseEngine databaseEngine, string databaseName) { int nextContextPosition = Contexts.Count; // create the UnitOfWorkContext // var mappingInfo = MappingInfo.From(typeof(GuidEntityForTesting).Assembly, typeof(FluentProduct).Assembly); InitializeNHibernateAndIoC(containerPath, databaseEngine, databaseName, mappingInfo, _ => { }); var context = Contexts[nextContextPosition]; Assert.IsNotNull(context); if (containerPath != null) { Assert.AreEqual(containerPath, context.ContainerConfigPath); } else { Assert.IsEmpty(context.ContainerConfigPath); } Assert.AreEqual(databaseEngine, context.DatabaseEngine); if (databaseName.IsWhiteSpace()) { Assert.AreEqual(NHibernateInitializer.DeriveDatabaseNameFrom(databaseEngine, mappingInfo.MappingAssemblies[0]), context.DatabaseName); } else { Assert.AreEqual(databaseName, context.DatabaseName); } Assert.AreEqual(CurrentContext, context, "Context just build has been assigned to CurrentContext"); }