Exemple #1
0
        public void Can_Construct_And_Get_Result()
        {
            var globalSettings = TestObjects.GetGlobalSettings();

            var umbracoContextFactory = new UmbracoContextFactory(
                Current.UmbracoContextAccessor,
                Mock.Of <IPublishedSnapshotService>(),
                new TestVariationContextAccessor(),
                new TestDefaultCultureAccessor(),
                TestObjects.GetUmbracoSettings(),
                globalSettings,
                new UrlProviderCollection(Enumerable.Empty <IUrlProvider>()),
                new MediaUrlProviderCollection(Enumerable.Empty <IMediaUrlProvider>()),
                Mock.Of <IUserService>());

            var umbracoContextReference = umbracoContextFactory.EnsureUmbracoContext(Mock.Of <HttpContextBase>());
            var umbracoContext          = umbracoContextReference.UmbracoContext;

            var umbracoContextAccessor = new TestUmbracoContextAccessor(umbracoContext);

            var ctrl = new TestSurfaceController(umbracoContextAccessor);

            var result = ctrl.Index();

            Assert.IsNotNull(result);
        }
Exemple #2
0
        public void Can_Construct_And_Get_Result()
        {
            var appCtx = new ApplicationContext(
                CacheHelper.CreateDisabledCacheHelper(),
                new ProfilingLogger(Mock.Of <ILogger>(), Mock.Of <IProfiler>()));

            var umbCtx = UmbracoContext.EnsureContext(
                new Mock <HttpContextBase>().Object,
                appCtx,
                new Mock <WebSecurity>(null, null).Object,
                Mock.Of <IUmbracoSettingsSection>(),
                Enumerable.Empty <IUrlProvider>(),
                true);

            var ctrl = new TestSurfaceController(umbCtx);

            var result = ctrl.Index();

            Assert.IsNotNull(result);
        }
    public void Can_Construct_And_Get_Result()
    {
        var backofficeSecurityAccessor = Mock.Of <IBackOfficeSecurityAccessor>();

        Mock.Get(backofficeSecurityAccessor).Setup(x => x.BackOfficeSecurity).Returns(Mock.Of <IBackOfficeSecurity>());
        var globalSettings = new GlobalSettings();

        var umbracoContextFactory = TestUmbracoContextFactory.Create(globalSettings, _umbracoContextAccessor);

        var umbracoContextReference = umbracoContextFactory.EnsureUmbracoContext();
        var umbracoContext          = umbracoContextReference.UmbracoContext;

        var umbracoContextAccessor = new TestUmbracoContextAccessor(umbracoContext);

        var ctrl = new TestSurfaceController(umbracoContextAccessor, Mock.Of <IPublishedContentQuery>(), Mock.Of <IPublishedUrlProvider>());

        var result = ctrl.Index();

        Assert.IsNotNull(result);
    }
Exemple #4
0
        public void Can_Construct_And_Get_Result()
        {
            var globalSettings = TestObjects.GetGlobalSettings();
            var umbracoContext = UmbracoContext.EnsureContext(
                Current.UmbracoContextAccessor,
                new Mock <HttpContextBase>().Object,
                Mock.Of <IPublishedSnapshotService>(),
                new Mock <WebSecurity>(null, null, globalSettings).Object,
                TestObjects.GetUmbracoSettings(),
                Enumerable.Empty <IUrlProvider>(),
                globalSettings,
                new TestVariationContextAccessor(),
                true);

            var ctrl = new TestSurfaceController(umbracoContext);

            var result = ctrl.Index();

            Assert.IsNotNull(result);
        }