예제 #1
0
 public void TestAddUriStructureOk()
 {
     try
     {
         ConfigJsonHandler          configJsonHandler          = new ConfigJsonHandler();
         SchemaConfigFileOperations schemaConfigFileOperations = new SchemaConfigFileOperations(configJsonHandler);
         CreateBackUpConfig();
         UriStructureGeneral uriSchema         = configJsonHandler.GetUrisConfig();
         UriStructure        newUriStructure   = CreateUriStructureExample("newUriExample");
         ResourcesClass      newResourcesClass = CreateResourceClassExample("newUriExample", "rsp", "pipaon");
         int oldResourcesClassesCount          = uriSchema.ResourcesClasses.Count;
         int oldUriStructuresCount             = uriSchema.UriStructures.Count;
         configJsonHandler.AddUriStructureInfo(newUriStructure, newResourcesClass);
         schemaConfigFileOperations.SaveConfigJson();
         ConfigJsonHandler   configJsonHandler2 = new ConfigJsonHandler();
         UriStructureGeneral uriSchema2         = configJsonHandler2.GetUrisConfig();
         RestoreBackUpConfig();
         configJsonHandler2.LoadConfigJson();
         Assert.True(oldResourcesClassesCount + 1 == uriSchema2.ResourcesClasses.Count && oldUriStructuresCount + 1 == uriSchema2.UriStructures.Count);
     }
     catch (Exception)
     {
         RestoreBackUpConfig();
     }
 }
예제 #2
0
 public void TestDeleteUriStructureOk()
 {
     try
     {
         ConfigJsonHandler configJsonHandler = new ConfigJsonHandler();
         IsDeleting = true;
         CreateBackUpConfig();
         UriStructureGeneral uriSchema = configJsonHandler.GetUrisConfig();
         int oldResourcesClassesCount  = uriSchema.ResourcesClasses.Count;
         int oldUriStructuresCount     = uriSchema.UriStructures.Count;
         if (configJsonHandler.ExistUriStructure("uriPublicationStructure"))
         {
             configJsonHandler.DeleteUriStructureInfo("uriPublicationStructure");
             SchemaConfigFileOperations schemaConfigFileOperations = new SchemaConfigFileOperations(configJsonHandler);
             schemaConfigFileOperations.SaveConfigJson();
             UriStructureGeneral uriSchema2 = configJsonHandler.GetUrisConfig();
             RestoreBackUpConfig();
             configJsonHandler.LoadConfigJson();
             IsDeleting = false;
             Assert.True(oldResourcesClassesCount == uriSchema2.ResourcesClasses.Count + 1 && oldUriStructuresCount == uriSchema2.UriStructures.Count + 1);
         }
         else
         {
             IsDeleting = false;
             Assert.True(false);
         }
     }
     catch (Exception)
     {
         RestoreBackUpConfig();
         IsDeleting = false;
     }
 }