Ejemplo n.º 1
0
        public void CreateFileTest()
        {
            using (HttpClient client = ApiHttpClient.Create($"{Globals.TEST_SERVER}:{Globals.TEST_PORT}")) {
                string fileName = "test_file";

                // Web Server Scope
                JObject webServerFeature = GetDefaultDocumentFeature(client, null, null);
                Assert.NotNull(webServerFeature);

                CreateAndRemoveFile(client, webServerFeature, fileName);

                // Site Scope
                Sites.EnsureNoSite(client, TEST_SITE_NAME);
                JObject site        = Sites.CreateSite(client, TEST_SITE_NAME, 50311, @"c:\sites\test_site");
                JObject siteFeature = GetDefaultDocumentFeature(client, site.Value <string>("name"), null);
                Assert.NotNull(siteFeature);

                CreateAndRemoveFile(client, siteFeature, fileName);

                // Application Scope
                JObject app        = Applications.CreateApplication(client, "test_app", @"c:\sites\test_site\test_application", site);
                JObject appFeature = GetDefaultDocumentFeature(client, site.Value <string>("name"), app.Value <string>("path"));
                Assert.NotNull(appFeature);

                CreateAndRemoveFile(client, appFeature, fileName);

                // Vdir Scope
                JObject vdir        = VirtualDirectories.CreateVdir(client, "test_vdir", @"c:\sites\test_site\test_vdir", site);
                JObject vdirFeature = GetDefaultDocumentFeature(client, site.Value <string>("name"), vdir.Value <string>("path"));
                Assert.NotNull(vdirFeature);

                CreateAndRemoveFile(client, vdirFeature, fileName);

                // Directory Scope
                JObject directoryFeature = GetDefaultDocumentFeature(client, site.Value <string>("name"), "/test_directory");
                Assert.NotNull(directoryFeature);

                CreateAndRemoveFile(client, directoryFeature, fileName);
            }
        }
Ejemplo n.º 2
0
        public void ChangeAllProperties()
        {
            using (HttpClient client = ApiHttpClient.Create($"{Globals.TEST_SERVER}:{Globals.TEST_PORT}")) {
                // Web Server Scope
                JObject webServerFeature = GetCompressionFeature(client, null, null);

                ChangeAndRestoreProps(client, webServerFeature);

                // Site Scope
                Sites.EnsureNoSite(client, TEST_SITE_NAME);
                JObject site        = Sites.CreateSite(client, TEST_SITE_NAME, 53010, @"c:\sites\test_site");
                JObject siteFeature = GetCompressionFeature(client, site.Value <string>("name"), null);

                ChangeAndRestoreProps(client, siteFeature);

                // Application Scope
                JObject app        = Applications.CreateApplication(client, "test_app", @"c:\sites\test_site\test_application", site);
                JObject appFeature = GetCompressionFeature(client, site.Value <string>("name"), app.Value <string>("path"));
                Assert.NotNull(appFeature);

                ChangeAndRestoreProps(client, appFeature);

                // Vdir Scope
                JObject vdir        = VirtualDirectories.CreateVdir(client, "test_vdir", @"c:\sites\test_site\test_vdir", site);
                JObject vdirFeature = GetCompressionFeature(client, site.Value <string>("name"), vdir.Value <string>("path"));
                Assert.NotNull(vdirFeature);

                ChangeAndRestoreProps(client, vdirFeature);

                // Directory Scope
                JObject directoryFeature = GetCompressionFeature(client, site.Value <string>("name"), "/test_directory");
                Assert.NotNull(directoryFeature);

                ChangeAndRestoreProps(client, directoryFeature);

                Sites.DeleteSite(client, Utils.Self(site));
            }
        }