public void start()
        {
            var cassini = new API_Cassini();
            var port = cassini.port();
            var url = cassini.url();
            var port_BeforeStart = port.tcpClient();            

            cassini.start();
            var port_AfterStart = port.tcpClient();
            var html = url.get_Html();            

            cassini.stop();
            var port_AfterStop  = port.tcpClient();

            Assert.Less     (0,port);
            Assert.IsNull   (port_BeforeStart);
            Assert.IsNotNull(port_AfterStart);
            Assert.IsNull   (port_AfterStop);
            Assert.IsNotNull(url);
            Assert.IsTrue   (html.valid());
            Assert.IsTrue   (html.contains("Directory Listing"));

            //test null data
            Assert.IsNull((null as API_Cassini).start());        
    
            //delete site folder
            cassini.PhysicalPath.delete_Folder();
        }
        /// <summary>
        /// Returns the file path to the url provided (urlToMap)
        ///
        /// For example http://server:port:/a/file.aspx should return c:\path\to\server\a\file.aspx
        /// </summary>
        /// <param name="apiCassini"></param>
        /// <param name="urlToMap"></param>
        /// <returns></returns>
        public static string file_From_Url(this API_Cassini apiCassini, string urlToMap)
        {
            var url = apiCassini.url();

            if (urlToMap.contains(url))
            {
                return(apiCassini.mapPath(urlToMap.remove(url)));
            }
            return(null);
        }
        /// <summary>
        /// Returns the url to the file provided
        ///
        /// For example c:\path\to\server\a\file.aspx should return http://server:port:/a/file.aspx
        /// </summary>
        /// <param name="apiCassini"></param>
        /// <param name="fileToMap"></param>
        /// <returns></returns>
        public static string url_From_File(this API_Cassini apiCassini, string fileToMap)
        {
            var webRoot = apiCassini.webRoot();

            if (fileToMap.contains(webRoot))
            {
                return(apiCassini.url(fileToMap.remove(webRoot)));
            }
            return(null);
        }
예제 #4
0
        public static void Main()
        {           
            var server = new Server("test".tempDir());
            var host = server.invoke("GetHost");


            var cassini = new API_Cassini();
            cassini.start();
            var browser = "FluentSharp.AspNet_Mvc".popupWindow()
                                                 .add_WebBrowser()
                                                 .add_NavigationBar();
            browser.open(cassini.url());
            browser.waitForClose();
            cassini.stop();
        }
        public virtual void testFixtureSetUp()
        {
            webRoot           = this.teamMentor_Root_OnDisk() .assert_Folder_Exists();  // this points to a folder with the full TM
            path_XmlLibraries = "path_XmlLibraries".tempDir() .assert_Folder_Exists();  // this points to a temp folder

            apiCassini = new API_Cassini(webRoot)        .assert_Not_Null();
            port       = apiCassini.port()               .assert_Not_Default();
            siteUri    = apiCassini.url().uri();

            apiCassini.webRoot().assert_Equal_To(webRoot);

            port      .tcpClient().assert_Null();
            apiCassini.start();

            this.tmProxy().set_Custom_Path_XmlDatabase(path_XmlLibraries);              // configure TM to the temp path_XmlLibraries folder for all files created
        }
        public void Get_Controller_Via_Cassini()
        {                               
            var server = new API_Cassini(webRoot);

            server.start();

            var testUrl     = server.url() + "Test";
            var html        = testUrl.html();
            var expected    = "Razor Page Test";
            
            
            Assert.IsTrue(html.contains(expected));

            /*"view site".popupWindow()
                       .add_WebBrowser_with_NavigationBar()
                       .open(server.url())
                       .waitForClose();
            */
            server.stop();
        }
예제 #7
0
 /// <summary>
 /// Resources a virtual path into a full url
 ///
 /// For example if <code>virtualPath="test.txt"</code>, the return value will be <code>http://server:port/test.txt</code>
 /// </summary>
 /// <param name="apiCassini"></param>
 /// <param name="virtualPath"></param>
 /// <returns></returns>
 public static string        url(this API_Cassini apiCassini, string virtualPath)
 {
     return(apiCassini.url()
            .uri()
            .append(virtualPath).str());
 }
        public void Browser_Website()
        {
            var cassini = new API_Cassini();
            cassini.start();
            var browser = "FluentSharp - Test side".popupWindow().add_WebBrowser();
            
            browser.html().assert_Empty();

            browser.open(cassini.url()).waitForCompleted();
                   
            
            browser.html().assert_Not_Empty()
                          .assert_Contains("Directory Listing");            

            //delete site folder
            cassini.PhysicalPath.delete_Folder();
            browser.closeForm();

        }