/// <summary> /// Creates a new HiveManager with an NHibernate default mapping group and the supplied provider mapping groups /// appended /// </summary> /// <param name="providerMappingGroups"></param> /// <param name="frameworkContext"></param> /// <returns></returns> public static IHiveManager NewWithNhibernate(IEnumerable <ProviderMappingGroup> providerMappingGroups, FakeFrameworkContext frameworkContext) { var helper = new NhibernateTestSetupHelper(frameworkContext); var uriMatch = new WildcardUriMatch(new Uri("content://")); var persistenceMappingGroup = new ProviderMappingGroup( "default", uriMatch, helper.ReadonlyProviderSetup, helper.ProviderSetup, frameworkContext); return(new HiveManager(new[] { persistenceMappingGroup }.Union(providerMappingGroups), frameworkContext)); }
public static TypedEntity SetupTestData(Guid newGuid, Guid newGuidRedHerring, NhibernateTestSetupHelper repo) { var entity = HiveModelCreationHelper.MockTypedEntity(); entity.Id = new HiveId(newGuid); entity.EntitySchema.Alias = "schema-alias1"; var existingDef = entity.EntitySchema.AttributeDefinitions[0]; var newDef = HiveModelCreationHelper.CreateAttributeDefinition("aliasForQuerying", "", "", existingDef.AttributeType, existingDef.AttributeGroup, true); entity.EntitySchema.AttributeDefinitions.Add(newDef); entity.Attributes.Add(new TypedAttribute(newDef, "my-new-value")); entity.Attributes[1].DynamicValue = "not-on-red-herring"; entity.Attributes[NodeNameAttributeDefinition.AliasValue].Values["UrlName"] = "my-test-route"; var redHerringEntity = HiveModelCreationHelper.MockTypedEntity(); redHerringEntity.Id = new HiveId(newGuidRedHerring); redHerringEntity.EntitySchema.Alias = "redherring-schema"; using (var uow = repo.ProviderSetup.UnitFactory.Create()) { uow.EntityRepository.AddOrUpdate(entity); uow.EntityRepository.AddOrUpdate(redHerringEntity); uow.Complete(); } return(entity); }