Exemplo n.º 1
0
        public void Can_Perform_GetAll_On_MediaTypeRepository()
        {
            // Arrange
            IScopeProvider provider = ScopeProvider;

            using (IScope scope = provider.CreateScope())
            {
                MediaTypeRepository repository = CreateRepository(provider);

                // Act
                IEnumerable <IMediaType> mediaTypes = repository.GetMany();
                int count =
                    ScopeAccessor.AmbientScope.Database.ExecuteScalar <int>(
                        "SELECT COUNT(*) FROM umbracoNode WHERE nodeObjectType = @NodeObjectType",
                        new { NodeObjectType = Constants.ObjectTypes.MediaType });

                // Assert
                Assert.That(mediaTypes.Any(), Is.True);
                Assert.That(mediaTypes.Count(), Is.EqualTo(count));
            }
        }
        public void Can_Verify_Fresh_Entity_Is_Not_Dirty()
        {
            // Arrange
            IScopeProvider provider = ScopeProvider;

            using (IScope scope = provider.CreateScope())
            {
                UserGroupRepository repository = CreateRepository(provider);

                UserGroup userGroup = UserGroupBuilder.CreateUserGroup();
                repository.Save(userGroup);
                scope.Complete();

                // Act
                IUserGroup resolved = repository.Get((int)userGroup.Id);
                bool       dirty    = ((UserGroup)resolved).IsDirty();

                // Assert
                Assert.That(dirty, Is.False);
            }
        }
Exemplo n.º 3
0
        public JsonResult CheckDb()
        {
            bool success = false;

            using (var scope = _scopeProvider.CreateScope()) {
                object settings = scope.Database.Query <object>(@"SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'gcs_searchsettings'");

                if (settings != null)
                {
                    success = true;
                }
            }

            return(new JsonResult()
            {
                Data = new {
                    Success = success
                },
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Exemplo n.º 4
0
        public void Can_Perform_GetByQuery_On_RelationTypeRepository()
        {
            // Arrange
            IScopeProvider provider = ScopeProvider;

            using (IScope scope = provider.CreateScope())
            {
                RelationTypeRepository repository = CreateRepository(provider);

                // Act
                System.Guid                 childObjType = Constants.ObjectTypes.DocumentType;
                IQuery <IRelationType>      query        = provider.CreateQuery <IRelationType>().Where(x => x.ChildObjectType == childObjType);
                IEnumerable <IRelationType> result       = repository.Get(query);

                // Assert
                Assert.That(result, Is.Not.Null);
                Assert.That(result.Any(), Is.True);
                Assert.That(result.Any(x => x == null), Is.False);
                Assert.That(result.Count(), Is.EqualTo(1));
            }
        }
Exemplo n.º 5
0
        public void Can_Perform_Get_On_LanguageRepository()
        {
            // Arrange
            IScopeProvider provider = ScopeProvider;

            using (IScope scope = provider.CreateScope())
            {
                scope.Database.AsUmbracoDatabase().EnableSqlTrace = true;
                LanguageRepository repository = CreateRepository(provider);

                // Act
                ILanguage language = repository.Get(1);

                // Assert
                Assert.That(language, Is.Not.Null);
                Assert.That(language.HasIdentity, Is.True);
                Assert.That(language.CultureName, Is.EqualTo("English (United States)"));
                Assert.That(language.IsoCode, Is.EqualTo("en-US"));
                Assert.That(language.FallbackLanguageId, Is.Null);
            }
        }
        public void Can_Perform_Get_On_DictionaryRepository_When_No_Language_Assigned()
        {
            // Arrange
            IScopeProvider provider = ScopeProvider;

            using (provider.CreateScope())
            {
                IDictionaryRepository repository = CreateRepository();
                var dictionaryItem = (IDictionaryItem) new DictionaryItem("Testing1235");

                repository.Save(dictionaryItem);

                // re-get
                dictionaryItem = repository.Get(dictionaryItem.Id);

                // Assert
                Assert.That(dictionaryItem, Is.Not.Null);
                Assert.That(dictionaryItem.ItemKey, Is.EqualTo("Testing1235"));
                Assert.That(dictionaryItem.Translations.Any(), Is.False);
            }
        }
Exemplo n.º 7
0
        public void Can_Verify_PropertyTypes_On_Video_MediaType()
        {
            // Arrange
            IScopeProvider provider = ScopeProvider;

            using (IScope scope = provider.CreateScope())
            {
                MediaTypeRepository repository = CreateRepository(provider);

                MediaType mediaType = MediaTypeBuilder.CreateNewMediaType();

                repository.Save(mediaType);

                // Act
                IMediaType contentType = repository.Get(mediaType.Id);

                // Assert
                Assert.That(contentType.PropertyTypes.Count(), Is.EqualTo(2));
                Assert.That(contentType.PropertyGroups.Count(), Is.EqualTo(1));
            }
        }
Exemplo n.º 8
0
        private IMember CreateTestMember(IMemberType memberType = null, string name = null, string email = null, string password = null, string username = null, Guid?key = null)
        {
            IScopeProvider provider = ScopeProvider;

            using (IScope scope = provider.CreateScope())
            {
                MemberRepository repository = CreateRepository(provider);

                if (memberType == null)
                {
                    memberType = MemberTypeBuilder.CreateSimpleMemberType();
                    MemberTypeRepository.Save(memberType);
                }

                Member member = MemberBuilder.CreateSimpleMember(memberType, name ?? "Johnny Hefty", email ?? "*****@*****.**", password ?? "123", username ?? "hefty", key);
                repository.Save(member);
                scope.Complete();

                return(member);
            }
        }
Exemplo n.º 9
0
        private int CreateTestData(string isoName, out ContentType ct)
        {
            IScopeProvider provider = ScopeProvider;

            using (IScope scope = provider.CreateScope())
            {
                var globalSettings = new GlobalSettings();
                var lang           = new Language(globalSettings, isoName);
                LanguageRepository.Save(lang);

                ct = ContentTypeBuilder.CreateBasicContentType("test", "Test");
                ContentTypeRepository.Save(ct);
                var content = new Content("test", -1, ct)
                {
                    CreatorId = 0, WriterId = 0
                };
                DocumentRepository.Save(content);
                scope.Complete();
                return(content.Id);
            }
        }
Exemplo n.º 10
0
        public void DeleteMedia()
        {
            // Arrange
            IScopeProvider provider = ScopeProvider;

            using (IScope scope = provider.CreateScope())
            {
                MediaRepository repository = CreateRepository(provider, out MediaTypeRepository mediaTypeRepository);

                // Act
                IMedia media = repository.Get(_testFile.Id);
                repository.Delete(media);

                IMedia deleted = repository.Get(_testFile.Id);
                bool   exists  = repository.Exists(_testFile.Id);

                // Assert
                Assert.That(deleted, Is.Null);
                Assert.That(exists, Is.False);
            }
        }
Exemplo n.º 11
0
        public void GetPagedResultsByQuery_FilterMatchingSome()
        {
            // Arrange
            IScopeProvider provider = ScopeProvider;

            using (IScope scope = provider.CreateScope())
            {
                MediaRepository repository = CreateRepository(provider, out MediaTypeRepository mediaTypeRepository);

                // Act
                IQuery <IMedia> query = scope.SqlContext.Query <IMedia>().Where(x => x.Level == 2);

                IQuery <IMedia>      filter = scope.SqlContext.Query <IMedia>().Where(x => x.Name.Contains("File"));
                IEnumerable <IMedia> result = repository.GetPage(query, 0, 1, out long totalRecords, filter, Ordering.By("SortOrder"));

                // Assert
                Assert.That(totalRecords, Is.EqualTo(1));
                Assert.That(result.Count(), Is.EqualTo(1));
                Assert.That(result.First().Name, Is.EqualTo("Test File"));
            }
        }
        public void Can_Perform_GetAll_On_ContentTypeRepository()
        {
            // Arrange
            IScopeProvider provider = ScopeProvider;

            using (IScope scope = provider.CreateScope())
            {
                var repository = (ContentTypeRepository)ContentTypeRepository;

                // Act
                IEnumerable <IContentType> contentTypes = repository.GetMany();
                int count =
                    scope.Database.ExecuteScalar <int>(
                        "SELECT COUNT(*) FROM umbracoNode WHERE nodeObjectType = @NodeObjectType",
                        new { NodeObjectType = Constants.ObjectTypes.DocumentType });

                // Assert
                Assert.That(contentTypes.Any(), Is.True);
                Assert.That(contentTypes.Count(), Is.EqualTo(count));
            }
        }
Exemplo n.º 13
0
        public void UpdateMedia()
        {
            // Arrange
            IScopeProvider provider = ScopeProvider;

            using (IScope scope = provider.CreateScope())
            {
                MediaRepository repository = CreateRepository(provider, out MediaTypeRepository mediaTypeRepository);

                // Act
                IMedia content = repository.Get(_testFile.Id);
                content.Name = "Test File Updated";
                repository.Save(content);

                IMedia updatedContent = repository.Get(_testFile.Id);

                // Assert
                Assert.That(updatedContent.Id, Is.EqualTo(content.Id));
                Assert.That(updatedContent.Name, Is.EqualTo(content.Name));
            }
        }
Exemplo n.º 14
0
        public void QueryMember()
        {
            // Arrange
            IScopeProvider provider = ScopeProvider;

            using (IScope scope = provider.CreateScope())
            {
                MemberRepository repository = CreateRepository(provider);

                var     key    = Guid.NewGuid();
                IMember member = CreateTestMember(key: key);

                // Act
                IQuery <IMember>      query  = scope.SqlContext.Query <IMember>().Where(x => x.Key == key);
                IEnumerable <IMember> result = repository.Get(query);

                // Assert
                Assert.That(result.Count(), Is.EqualTo(1));
                Assert.That(result.First().Id, Is.EqualTo(member.Id));
            }
        }
        public WorkflowExecutorFixture()
        {
            Host = A.Fake <IWorkflowHost>();
            PersistenceProvider   = A.Fake <IPersistenceProvider>();
            ServiceProvider       = A.Fake <IServiceProvider>();
            ScopeProvider         = A.Fake <IScopeProvider>();
            Registry              = A.Fake <IWorkflowRegistry>();
            ResultProcesser       = A.Fake <IExecutionResultProcessor>();
            EventHub              = A.Fake <ILifeCycleEventPublisher>();
            CancellationProcessor = A.Fake <ICancellationProcessor>();
            DateTimeProvider      = A.Fake <IDateTimeProvider>();
            MiddlewareRunner      = A.Fake <IWorkflowMiddlewareRunner>();
            StepExecutor          = A.Fake <IStepExecutor>();

            Options = new WorkflowOptions(A.Fake <IServiceCollection>());

            var scope = A.Fake <IServiceScope>();

            A.CallTo(() => ScopeProvider.CreateScope(A <IStepExecutionContext> ._)).Returns(scope);
            A.CallTo(() => scope.ServiceProvider).Returns(ServiceProvider);

            A.CallTo(() => DateTimeProvider.Now).Returns(DateTime.Now);
            A.CallTo(() => DateTimeProvider.UtcNow).Returns(DateTime.UtcNow);

            A.CallTo(() => MiddlewareRunner
                     .RunPostMiddleware(A <WorkflowInstance> ._, A <WorkflowDefinition> ._))
            .Returns(Task.CompletedTask);

            A.CallTo(() => StepExecutor.ExecuteStep(A <IStepExecutionContext> ._, A <IStepBody> ._))
            .ReturnsLazily(call =>
                           call.Arguments[1].As <IStepBody>().RunAsync(
                               call.Arguments[0].As <IStepExecutionContext>()));

            //config logging
            var loggerFactory = new LoggerFactory();

            //loggerFactory.AddConsole(LogLevel.Debug);

            Subject = new WorkflowExecutor(Registry, ServiceProvider, ScopeProvider, DateTimeProvider, ResultProcesser, EventHub, CancellationProcessor, Options, MiddlewareRunner, StepExecutor, loggerFactory);
        }
        public IList <EnterspeedJob> GetFailedJobs()
        {
            var result = new List <EnterspeedJob>();

            using (var scope = _scopeProvider.CreateScope(autoComplete: true))
            {
                var failedJobs = scope.Database.Query <EnterspeedJobSchema>()
                                 .Where(x => x.JobState == EnterspeedJobState.Failed.GetHashCode())
                                 .OrderBy(x => x.CreatedAt)
                                 .ToList();

                result.AddRange(_mapper.MapEnumerable <EnterspeedJobSchema, EnterspeedJob>(failedJobs));
            }

            return(result);
        }
Exemplo n.º 17
0
        public void Can_Verify_That_A_Combination_Of_Adding_And_Deleting_PropertyTypes_Doesnt_Cause_Issues_For_Content_And_ContentType()
        {
            // Arrange
            IScopeProvider provider = ScopeProvider;

            using (IScope scope = provider.CreateScope())
            {
                ContentTypeRepository repository = ContentTypeRepository;

                IContentType contentType = repository.Get(_textpageContentType.Id);

                Content subpage = ContentBuilder.CreateTextpageContent(contentType, "Text Page 1", contentType.Id);
                DocumentRepository.Save(subpage);

                // Remove PropertyType
                contentType.RemovePropertyType("keywords");

                // Add PropertyType
                PropertyGroup propertyGroup = contentType.PropertyGroups.First(x => x.Name == "Meta");
                propertyGroup.PropertyTypes.Add(new PropertyType(ShortStringHelper, "test", ValueStorageType.Ntext, "metaAuthor")
                {
                    Name = "Meta Author", Description = string.Empty, Mandatory = false, SortOrder = 1, DataTypeId = -88
                });
                repository.Save(contentType);

                // Act
                IContent content = DocumentRepository.Get(subpage.Id);
                content.SetValue("metaAuthor", "John Doe");
                DocumentRepository.Save(content);

                // Assert
                IContent updated = DocumentRepository.Get(subpage.Id);
                Assert.That(updated.GetValue("metaAuthor").ToString(), Is.EqualTo("John Doe"));
                Assert.That(updated.Properties.First(x => x.Alias == "description").GetValue(), Is.EqualTo("This is the meta description for a textpage"));

                Assert.That(contentType.PropertyTypes.Count(), Is.EqualTo(4));
                Assert.That(contentType.PropertyTypes.Any(x => x.Alias == "metaAuthor"), Is.True);
                Assert.That(contentType.PropertyTypes.Any(x => x.Alias == "keywords"), Is.False);
            }
        }
Exemplo n.º 18
0
        public void Can_Perform_Delete_On_ContentTypeRepository()
        {
            // Arrange
            IScopeProvider provider = ScopeProvider;

            using (IScope scope = provider.CreateScope())
            {
                ContentTypeRepository repository = ContentTypeRepository;

                // Act
                ContentType contentType = ContentTypeBuilder.CreateSimpleContentType(defaultTemplateId: 0);
                repository.Save(contentType);

                IContentType contentType2 = repository.Get(contentType.Id);
                repository.Delete(contentType2);

                bool exists = repository.Exists(contentType.Id);

                // Assert
                Assert.That(exists, Is.False);
            }
        }
Exemplo n.º 19
0
        public void Can_Perform_GetAll_By_Guid_On_ContentTypeRepository()
        {
            // Arrange
            IScopeProvider provider = ScopeProvider;

            using (IScope scope = provider.CreateScope())
            {
                var    repository = (ContentTypeRepository)ContentTypeRepository;
                Guid[] allGuidIds = repository.GetMany().Select(x => x.Key).ToArray();

                // Act
                IEnumerable <IContentType> contentTypes = ((IReadRepository <Guid, IContentType>)repository).GetMany(allGuidIds);
                int count =
                    ScopeAccessor.AmbientScope.Database.ExecuteScalar <int>(
                        "SELECT COUNT(*) FROM umbracoNode WHERE nodeObjectType = @NodeObjectType",
                        new { NodeObjectType = Constants.ObjectTypes.DocumentType });

                // Assert
                Assert.That(contentTypes.Any(), Is.True);
                Assert.That(contentTypes.Count(), Is.EqualTo(count));
            }
        }
        public void Can_Perform_Add_View_With_Default_Content()
        {
            // Arrange
            IScopeProvider provider = ScopeProvider;

            using (provider.CreateScope())
            {
                ITemplateRepository repository = CreateRepository(provider);

                // Act
                var template = new Template(ShortStringHelper, "test", "test")
                {
                    Content = "mock-content"
                };
                repository.Save(template);

                // Assert
                Assert.That(repository.Get("test"), Is.Not.Null);
                Assert.That(FileSystems.MvcViewsFileSystem.FileExists("test.cshtml"), Is.True);
                Assert.AreEqual("mock-content", template.Content.StripWhitespace());
            }
        }
Exemplo n.º 21
0
        public void Can_Remove_Macro_Property()
        {
            // Arrange
            IScopeProvider provider = ScopeProvider;

            using (provider.CreateScope())
            {
                var repository = new MacroRepository((IScopeAccessor)provider, AppCaches.Disabled, _logger, ShortStringHelper);

                var macro = new Macro(ShortStringHelper, "newmacro", "A new macro", "~/views/macropartials/test1.cshtml");
                macro.Properties.Add(new MacroProperty("blah1", "New1", 4, "test.editor"));
                repository.Save(macro);

                IMacro result = repository.Get(macro.Id);
                result.Properties.Remove("blah1");
                repository.Save(result);

                // Assert
                result = repository.Get(macro.Id);
                Assert.AreEqual(0, result.Properties.Values.Count());
            }
        }
Exemplo n.º 22
0
        public void Can_Add()
        {
            IContent[] content = CreateTestData(3).ToArray();

            IScopeProvider provider = ScopeProvider;

            using (IScope scope = provider.CreateScope())
            {
                ScopeAccessor.AmbientScope.Database.AsUmbracoDatabase().EnableSqlTrace = true;
                var repo = new PublicAccessRepository((IScopeAccessor)provider, AppCaches, LoggerFactory.CreateLogger <PublicAccessRepository>());

                PublicAccessRule[] rules = new[]
                {
                    new PublicAccessRule
                    {
                        RuleValue = "test",
                        RuleType  = "RoleName"
                    },
                };
                var entry = new PublicAccessEntry(content[0], content[1], content[2], rules);
                repo.Save(entry);

                PublicAccessEntry[] found = repo.GetMany().ToArray();

                Assert.AreEqual(1, found.Length);
                Assert.AreEqual(content[0].Id, found[0].ProtectedNodeId);
                Assert.AreEqual(content[1].Id, found[0].LoginNodeId);
                Assert.AreEqual(content[2].Id, found[0].NoAccessNodeId);
                Assert.IsTrue(found[0].HasIdentity);
                Assert.AreNotEqual(default(DateTime), found[0].CreateDate);
                Assert.AreNotEqual(default(DateTime), found[0].UpdateDate);
                Assert.AreEqual(1, found[0].Rules.Count());
                Assert.AreEqual("test", found[0].Rules.First().RuleValue);
                Assert.AreEqual("RoleName", found[0].Rules.First().RuleType);
                Assert.AreNotEqual(default(DateTime), found[0].Rules.First().CreateDate);
                Assert.AreNotEqual(default(DateTime), found[0].Rules.First().UpdateDate);
                Assert.IsTrue(found[0].Rules.First().HasIdentity);
            }
        }
Exemplo n.º 23
0
        private IEnumerable <IContent> CreateTestData(int count)
        {
            IScopeProvider provider = ScopeProvider;

            using (IScope scope = provider.CreateScope())
            {
                ContentType ct = ContentTypeBuilder.CreateBasicContentType("testing");
                ContentTypeRepository.Save(ct);

                var result = new List <IContent>();
                for (int i = 0; i < count; i++)
                {
                    var c = new Content("test" + i, -1, ct);
                    DocumentRepository.Save(c);
                    result.Add(c);
                }

                scope.Complete();

                return(result);
            }
        }
Exemplo n.º 24
0
        public void Can_Update_ContentType_With_PropertyType_Removed()
        {
            // Arrange
            IScopeProvider provider = ScopeProvider;

            using (IScope scope = provider.CreateScope())
            {
                ContentTypeRepository repository  = ContentTypeRepository;
                IContentType          contentType = repository.Get(_textpageContentType.Id);

                // Act
                contentType.PropertyGroups["meta"].PropertyTypes.Remove("description");
                repository.Save(contentType);

                IContentType result = repository.Get(_textpageContentType.Id);

                // Assert
                Assert.That(result.PropertyTypes.Any(x => x.Alias == "description"), Is.False);
                Assert.That(contentType.PropertyGroups.Count, Is.EqualTo(result.PropertyGroups.Count));
                Assert.That(contentType.PropertyTypes.Count(), Is.EqualTo(result.PropertyTypes.Count()));
            }
        }
Exemplo n.º 25
0
        public void SaveMember()
        {
            IScopeProvider provider = ScopeProvider;

            using (IScope scope = provider.CreateScope())
            {
                MemberRepository repository = CreateRepository(provider);

                IMember member = CreateTestMember();

                IMember sut = repository.Get(member.Id);

                Assert.That(sut, Is.Not.Null);
                Assert.That(sut.HasIdentity, Is.True);
                Assert.That(sut.Name, Is.EqualTo("Johnny Hefty"));
                Assert.That(sut.Email, Is.EqualTo("*****@*****.**"));
                Assert.That(sut.RawPasswordValue, Is.EqualTo("123"));
                Assert.That(sut.Username, Is.EqualTo("hefty"));

                TestHelper.AssertPropertyValuesAreEqual(sut, member);
            }
        }
Exemplo n.º 26
0
        public void GetAllMembers()
        {
            IScopeProvider provider = ScopeProvider;

            using (IScope scope = provider.CreateScope())
            {
                MemberRepository repository = CreateRepository(provider);

                IMemberType type = CreateTestMemberType();
                for (int i = 0; i < 5; i++)
                {
                    CreateTestMember(type, "Test " + i, "test" + i + "@test.com", "pass" + i, "test" + i);
                }

                IEnumerable <IMember> members = repository.GetMany();

                Assert.That(members, Is.Not.Null);
                Assert.That(members.Any(x => x == null), Is.False);
                Assert.That(members.Count(), Is.EqualTo(5));
                Assert.That(members.Any(x => x.HasIdentity == false), Is.False);
            }
        }
Exemplo n.º 27
0
        public void Can_Verify_PropertyType_With_No_Group()
        {
            // Arrange
            IScopeProvider provider = ScopeProvider;

            using (IScope scope = provider.CreateScope())
            {
                ContentTypeRepository repository  = ContentTypeRepository;
                IContentType          contentType = repository.Get(_textpageContentType.Id);

                Assert.That(contentType.PropertyGroups.Count, Is.EqualTo(2));
                Assert.That(contentType.PropertyTypes.Count(), Is.EqualTo(4));

                // Act
                var urlAlias = new PropertyType(ShortStringHelper, "test", ValueStorageType.Nvarchar, "urlAlias")
                {
                    Name        = "Url Alias",
                    Description = string.Empty,
                    Mandatory   = false,
                    SortOrder   = 1,
                    DataTypeId  = -88
                };

                bool addedPropertyType = contentType.AddPropertyType(urlAlias);

                Assert.That(contentType.PropertyGroups.Count, Is.EqualTo(2));
                Assert.That(contentType.PropertyTypes.Count(), Is.EqualTo(5));

                repository.Save(contentType);

                // Assert
                IContentType updated = repository.Get(_textpageContentType.Id);
                Assert.That(addedPropertyType, Is.True);
                Assert.That(updated.PropertyGroups.Count, Is.EqualTo(2));
                Assert.That(updated.PropertyTypes.Count(), Is.EqualTo(5));
                Assert.That(updated.PropertyTypes.Any(x => x.Alias == "urlAlias"), Is.True);
                Assert.That(updated.PropertyTypes.First(x => x.Alias == "urlAlias").PropertyGroupId, Is.Null);
            }
        }
Exemplo n.º 28
0
        public bool ValidateProtectedContent(string path, string category)
        {
            if (category == IndexTypes.Content && !SupportProtectedContent)
            {
                //if the service is null we can't look this up so we'll return false
                if (_publicAccessService == null || _scopeProvider == null)
                {
                    return(false);
                }

                // explicit scope since we may be in a background thread
                using (_scopeProvider.CreateScope(autoComplete: true))
                {
                    if (_publicAccessService.IsProtected(path))
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
        public void Can_Perform_Get_On_RelationTypeRepository()
        {
            // Arrange
            IScopeProvider provider = ScopeProvider;

            using (provider.CreateScope())
            {
                RelationTypeRepository repository = CreateRepository(provider);

                // Act
                IRelationType relationType = repository.Get(8);

                // Assert
                Assert.That(relationType, Is.Not.Null);
                Assert.That(relationType.HasIdentity, Is.True);
                Assert.That(relationType.IsBidirectional, Is.True);
                Assert.That(relationType.Alias, Is.EqualTo("relateContentToMedia"));
                Assert.That(relationType.Name, Is.EqualTo("Relate Content to Media"));
                Assert.That(relationType.ChildObjectType, Is.EqualTo(Constants.ObjectTypes.Media));
                Assert.That(relationType.ParentObjectType, Is.EqualTo(Constants.ObjectTypes.Document));
            }
        }
        public ControllerService()
        {
            this.scopeProvider = ConnectorContext.ScopeProvider;
            using (var scope = scopeProvider.CreateScope(autoComplete: true))
            {
                this.database = scope.Database;
                ApiKeyCache.UpdateCache(scope.Database);
            }
            this.userGroupService = new UserGroupService(ConnectorContext.UserService, database, ConnectorContext.Logger);
            this.languageService  = new LanguageDictionaryService(ConnectorContext.LocalizationService, ConnectorContext.DomainService, ConnectorContext.Logger);
            this.homeNode         = new HomeContentNode(ConnectorContext.ContentService, ConnectorContext.LocalizationService, ConnectorContext.DomainService, ConnectorContext.ContentTypeService, ConnectorContext.Logger);
            this.apiService       = new ApiKeysService(database);
            this.nodeHelper       = new NodeHelper();

            SaveAndPublish = bool.Parse(TenantGenerationOptions.SaveAndPublish);
            SecureUrls     = bool.Parse(TenantGenerationOptions.SecureUrls);
            SetupLocalUrls = bool.Parse(TenantGenerationOptions.SetupLocalUrls);

#if DEBUG
            SetupLocalUrls = true;
#endif
        }