private void RunTest( HiveManager hiveManager, FakeFrameworkContext frameworkContext, Action installCallback = null) { var attributeTypeRegistry = new CmsAttributeTypeRegistry(); AttributeTypeRegistry.SetCurrent(attributeTypeRegistry); var appContext = new FakeUmbracoApplicationContext(hiveManager, false); var mockedPropertyEditorFactory = new MockedPropertyEditorFactory(appContext); var resolverContext = new MockedMapResolverContext(frameworkContext, hiveManager, mockedPropertyEditorFactory, new MockedParameterEditorFactory()); var webmModelMapper = new CmsModelMapper(resolverContext); frameworkContext.SetTypeMappers(new FakeTypeMapperCollection(new AbstractMappingEngine[] { webmModelMapper, new FrameworkModelMapper(frameworkContext) })); var devDataset = DemoDataHelper.GetDemoData(appContext, attributeTypeRegistry); //Seup permissions var permissions = new Permission[] { new SavePermission(), new PublishPermission(), new HostnamesPermission(), new CopyPermission(), new MovePermission() } .Select(x => new Lazy<Permission, PermissionMetadata>(() => x, new PermissionMetadata(new Dictionary<string, object> { {"Id", x.Id}, {"Name", x.Name}, {"Type", x.Type} }))).ToArray(); var coreDataInstallTask = new EnsureCoreDataTask(frameworkContext, hiveManager, permissions); var devDatasetInstallTask = new DevDatasetInstallTask(frameworkContext, mockedPropertyEditorFactory, hiveManager, attributeTypeRegistry); //Act coreDataInstallTask.InstallOrUpgrade(); if (installCallback != null) installCallback(); devDatasetInstallTask.InstallOrUpgrade(); if (installCallback != null) installCallback(); //Assert var totalSchemaCount = CoreCmsData.RequiredCoreSchemas().Count() + devDataset.DocTypes.Count() + 1; // +1 for SystemRoot schema var totalEntityCount = CoreCmsData.RequiredCoreUserGroups(permissions).Count() + CoreCmsData.RequiredCoreRootNodes().Count() + devDataset.ContentData.Count(); var totalAttributeTypeCount = CoreCmsData.RequiredCoreSystemAttributeTypes().Count() + CoreCmsData.RequiredCoreUserAttributeTypes().Count(); DoCoreAssertions(hiveManager, totalSchemaCount, totalEntityCount, totalAttributeTypeCount, 2, permissions); }
public PermissionResult(Permission permission, HiveId sourceId, PermissionStatus status) { Permission = permission; SourceId = sourceId; Status = status; }