public void Setup()
 {
     context       = HttpContextFactory.Context.mock();
     //response         = context.Response;
     handleRequest = new HandleUrlRequest();
     handleRequest.tmWebServices = tmWebServices;
 }
 public void Setup()
 {
     moqHttpContext   = new API_Moq_HttpContext();
     context          = HttpContextFactory.Context = moqHttpContext.httpContext();		//clean http request for each test
     context.Session["SessionID"] = userSessionId;
     handleUrlRequest = new HandleUrlRequest();
 }
示例#3
0
        public void Setup()
        {
            context                         =  HttpContextFactory.Context.mock();
            handleUrlRequest                = new HandleUrlRequest();
            tmFileStorage                   = new TM_FileStorage(false) { Path_XmlDatabase = "_siteData".tempDir() };

            Assert.IsTrue(tmFileStorage.Path_XmlDatabase.dirExists());
        }
        public void Issue_877_GuidanceItemViewer_and_GuidanceItemEditor_customizations_are_not_picked_up()
        {
            //check on hosted cassini appdaomain

            var guidanceItemViewer = this.webRoot.mapPath(@"Html_Pages\GuidanceItemViewer\GuidanceItemViewer.html").assert_File_Exists();            //if it works for guidanceItemEditor it will also work for guidanceItemEditor
            webRoot.mapPath(guidanceItemViewer).assert_File_Exists();

            siteUri.mapPath("article").GET().assert_Is(guidanceItemViewer.fileContents());
            siteUri.mapPath("viewer" ).GET().assert_Is(guidanceItemViewer.fileContents());

            var custom_Text = "This is a test".add_5_RandomLetters();
            path_SiteData.folder_Create_File("GuidanceItemViewer.html",        custom_Text)
                        .append_FileName_To(siteUri       ).assert_HTTP_GET_Is(custom_Text);

            siteUri.mapPath(@"Html_Pages\GuidanceItemViewer\GuidanceItemViewer.html").GET().assert_Is(custom_Text);
            siteUri.mapPath("article"                                               ).GET().assert_Is(custom_Text);
            siteUri.mapPath("viewer"                                                ).GET().assert_Is(custom_Text);

            // check on this thread's appdomain
            admin.assert();
            var tmpSiteData = "_tempSitData".tempDir();
            var tmpKey      = "abc"     .add_5_RandomLetters().lower();
            var tmpFileName = "abc.txt" .insert_5_RandomLetters();
            var tmContents  = "12345"   .add_5_RandomLetters();

            HttpContextFactory.Current.mock();

            new TM_FileStorage().Path_SiteData = tmpSiteData;

            var handleUrlRequest = new HandleUrlRequest();
            HandleUrlRequest.Server_Transfers.add(tmpKey, tmpFileName);

            Assert.DoesNotThrow     (()=> handleUrlRequest.transfer_Request("doesnotexist"));
            Assert.Throws<Exception>(()=> handleUrlRequest.transfer_Request("teammentor"));
            Assert.Throws<Exception>(()=> handleUrlRequest.transfer_Request(tmpKey));

            HttpContextFactory.Response.OutputStream.readToEnd().assert_Is(String.Empty);

            tmpSiteData.folder_Create_File(tmpFileName, tmContents);

            Assert.Throws<Exception>(()=> handleUrlRequest.transfer_Request(tmpKey));
            HttpContextFactory.Response.OutputStream.readToEnd().assert_Is(tmContents);

            tmpSiteData.assert_Folder_Deleted();
        }
示例#5
0
 public void Setup()
 {
     moqHttpContext   = new API_Moq_HttpContext();
     context          = HttpContextFactory.Context = moqHttpContext.httpContext();		//clean http request for each test
     handleUrlRequest = new HandleUrlRequest();
 }
示例#6
0
 public void Setup()
 {
     context       = HttpContextFactory.Context.mock();
     handleUrlRequest = new HandleUrlRequest();
 }