Ejemplo n.º 1
0
        public MockStartPage CreateStartPage(Action <ApplicationStartPage> action)
        {
            var startPage = new MockStartPage()
            {
                ExecuteAction = action
            };

            return(startPage);
        }
Ejemplo n.º 2
0
 public static MockStartPage CreateStartPage(Action<StartPage> pageExecuteAction, string pagePath = "~/_pagestart.cshtml") {
     var page = new MockStartPage() {
         VirtualPath = pagePath,
         ExecuteAction = p => {
             pageExecuteAction(p);
         }
     };
     return page;
 }
 public void ExecuteStartPageTest() {
     AppDomainUtils.RunInSeparateAppDomain(() => {
         var startPage = new MockStartPage() { ExecuteAction = p => p.AppState["x"] = "y" };
         ApplicationStartPage.ExecuteStartPage(new WebPageHttpApplication(),
             p => { },
             path => path == "~/_appstart.vbhtml",
             p => startPage,
             new string[] { "cshtml", "vbhtml" });
         Assert.AreEqual("y", startPage.ApplicationState["x"]);
     });
 }
        public void SetVirtualPathTest()
        {
            var page = new MockStartPage();

            Assert.Throws <NotSupportedException>(
                () =>
            {
                page.VirtualPath = "~/hello.cshtml";
            }
                );
        }
Ejemplo n.º 5
0
        public static MockStartPage CreateStartPage(Action <StartPage> pageExecuteAction, string pagePath = "~/_pagestart.cshtml")
        {
            var page = new MockStartPage()
            {
                VirtualPath   = pagePath,
                ExecuteAction = p => { pageExecuteAction(p); }
            };

            page.VirtualPathFactory  = new HashVirtualPathFactory(page);
            page.DisplayModeProvider = new DisplayModeProvider();
            return(page);
        }
Ejemplo n.º 6
0
        public static MockStartPage CreateStartPage(Action <StartPage> pageExecuteAction, string pagePath = "~/_pagestart.cshtml")
        {
            var page = new MockStartPage()
            {
                VirtualPath   = pagePath,
                ExecuteAction = p => {
                    pageExecuteAction(p);
                }
            };

            return(page);
        }
Ejemplo n.º 7
0
 public void ExecuteStartPageTest()
 {
     AppDomainUtils.RunInSeparateAppDomain(() => {
         var startPage = new MockStartPage()
         {
             ExecuteAction = p => p.AppState["x"] = "y"
         };
         ApplicationStartPage.ExecuteStartPage(new WebPageHttpApplication(),
                                               p => { },
                                               path => path == "~/_appstart.vbhtml",
                                               p => startPage,
                                               new string[] { "cshtml", "vbhtml" });
         Assert.AreEqual("y", startPage.ApplicationState["x"]);
     });
 }
Ejemplo n.º 8
0
 public void ExecuteStartPageTest()
 {
     AppDomainUtils.RunInSeparateAppDomain(() =>
     {
         var startPage = new MockStartPage()
         {
             ExecuteAction = p => p.AppState["x"] = "y"
         };
         var objectFactory = GetMockVirtualPathFactory(startPage);
         ApplicationStartPage.ExecuteStartPage(new WebPageHttpApplication(),
                                               p => { },
                                               objectFactory,
                                               new string[] { "cshtml", "vbhtml" });
         Assert.Equal("y", startPage.ApplicationState["x"]);
     });
 }
Ejemplo n.º 9
0
 public static MockStartPage CreateStartPage(Action<StartPage> pageExecuteAction, string pagePath = "~/_pagestart.cshtml")
 {
     var page = new MockStartPage()
     {
         VirtualPath = pagePath,
         ExecuteAction = p => { pageExecuteAction(p); }
     };
     page.VirtualPathFactory = new HashVirtualPathFactory(page);
     page.DisplayModeProvider = new DisplayModeProvider();
     return page;
 }
Ejemplo n.º 10
0
        public void GetVirtualPathTest()
        {
            var page = new MockStartPage();

            Assert.Equal(ApplicationStartPage.StartPageVirtualPath, page.VirtualPath);
        }
 public void ExecuteStartPageTest()
 {
     AppDomainUtils.RunInSeparateAppDomain(() =>
     {
         var startPage = new MockStartPage() { ExecuteAction = p => p.AppState["x"] = "y" };
         var objectFactory = GetMockVirtualPathFactory(startPage);
         ApplicationStartPage.ExecuteStartPage(new WebPageHttpApplication(),
                                               p => { },
                                               objectFactory,
                                               new string[] { "cshtml" });
         Assert.Equal("y", startPage.ApplicationState["x"]);
     });
 }
 public void SetVirtualPathTest()
 {
     var page = new MockStartPage();
     Assert.Throws<NotSupportedException>(() => { page.VirtualPath = "~/hello.cshtml"; });
 }
 public void GetVirtualPathTest()
 {
     var page = new MockStartPage();
     Assert.Equal(ApplicationStartPage.StartPageVirtualPath, page.VirtualPath);
 }
 public MockStartPage CreateStartPage(Action<ApplicationStartPage> action)
 {
     var startPage = new MockStartPage() { ExecuteAction = action };
     return startPage;
 }