Beispiel #1
0
        public void BasicActionTest()
        {
            //Setup Application Contact with mocks. Sets ApplicaitonContext.Current
            var appCtx = ApplicationContext.EnsureContext(
                new DatabaseContext(Mock.Of <IDatabaseFactory>(), Mock.Of <ILogger>(), new SqlSyntaxProviders(new[] { Mock.Of <ISqlSyntaxProvider>() })),
                new ServiceContext(),
                CacheHelper.CreateDisabledCacheHelper(),
                new ProfilingLogger(
                    Mock.Of <ILogger>(),
                    Mock.Of <IProfiler>()), true);

            //Setup UmbracoContext with mocks. Sets UmbracoContext.Current
            UmbracoContext.EnsureContext(
                Mock.Of <HttpContextBase>(),
                appCtx,
                new Mock <WebSecurity>(null, null).Object,
                Mock.Of <IUmbracoSettingsSection>(),
                Enumerable.Empty <IUrlProvider>(), true);

            var controller = new BasicTestSurfaceController();
            var res        = controller.BasicTestAction();
            var model      = res.Model as object;

            Assert.IsNotNull(model);
        }
        public void NuGetEngineActionTest()
        {
            //Now we can run a basic situation with no Umbraco boilerplate!
            var controller = new BasicTestSurfaceController();
            var res        = controller.BasicTestAction();
            var model      = res.Model as object;

            Assert.IsNotNull(model);
        }
        public void HelperActionTest()
        {
            //Setup UmbracoContext with mocks. Sets UmbracoContext.Current
            var ctx = UmbracoUnitTestHelper.GetUmbracoContext();

            var controller = new BasicTestSurfaceController();
            var res        = controller.BasicTestAction();
            var model      = res.Model as object;

            Assert.IsNotNull(model);
        }