Example #1
0
        public override void CreateTestData()
        {
            base.CreateTestData();

            var provider = TestObjects.GetScopeProvider(Logger);

            using (var scope = provider.CreateScope())
            {
                var repository  = new RedirectUrlRepository((IScopeAccessor)provider, AppCaches.Disabled, Mock.Of <ILogger>());
                var rootContent = ServiceContext.ContentService.GetRootContent().FirstOrDefault();
                var subPages    = ServiceContext.ContentService.GetPagedChildren(rootContent.Id, 0, 2, out _).ToList();
                _testPage    = subPages[0];
                _altTestPage = subPages[1];

                repository.Save(new RedirectUrl
                {
                    ContentKey = _testPage.Key,
                    Url        = _url,
                    Culture    = _cultureA
                });
                repository.Save(new RedirectUrl
                {
                    ContentKey = _altTestPage.Key,
                    Url        = _url,
                    Culture    = _cultureB
                });
                scope.Complete();
            }
        }
Example #2
0
    public override void CreateTestData()
    {
        base.CreateTestData();

        using (var scope = ScopeProvider.CreateScope())
        {
            var repository = new RedirectUrlRepository((IScopeAccessor)ScopeProvider, AppCaches.Disabled,
                                                       Mock.Of <ILogger <RedirectUrlRepository> >());
            var rootContent = ContentService.GetRootContent().First();
            var subPages    = ContentService.GetPagedChildren(rootContent.Id, 0, 3, out _).ToList();
            _firstSubPage  = subPages[0];
            _secondSubPage = subPages[1];
            _thirdSubPage  = subPages[2];


            repository.Save(new RedirectUrl {
                ContentKey = _firstSubPage.Key, Url = Url, Culture = CultureEnglish
            });
            Thread.Sleep(
                1000); //Added delay to ensure timestamp difference as sometimes they seem to have the same timestamp
            repository.Save(new RedirectUrl {
                ContentKey = _secondSubPage.Key, Url = Url, Culture = CultureGerman
            });
            Thread.Sleep(1000);
            repository.Save(new RedirectUrl {
                ContentKey = _thirdSubPage.Key, Url = UrlAlt, Culture = string.Empty
            });

            scope.Complete();
        }
    }