Exemplo n.º 1
0
        public static TestVault FromStream(Stream stream)
        {
            TestVault testVault = new TestVault();
            string    serialized;

            using (StreamReader reader = new StreamReader(stream))
            {
                serialized = reader.ReadToEnd();
            }

            VaultJSON vaultJson = JsonConvert.DeserializeObject <VaultJSON>(serialized);

            List <xObjTypeAdmin> objects = vaultJson.Objects;

            foreach (xObjTypeAdmin obj in objects)
            {
                testVault.objTypes.Add(new TestObjTypeAdmin(obj));
            }

            List <xPropertyDefAdmin> properties = vaultJson.Properties;

            foreach (xPropertyDefAdmin pda in properties)
            {
                testVault.propertyDefs.Add(new TestPropertyDefAdmin(pda));
            }

            List <xObjectClassAdmin> classes = vaultJson.Classes;

            foreach (xObjectClassAdmin oClass in classes)
            {
                TestObjectClassAdmin toca = new TestObjectClassAdmin(oClass);
                testVault.classAdmins.Add(toca);
                testVault.classes.Add(new TestObjectClass(toca));
            }

            List <xObjType> valueLists = vaultJson.ValueLists;

            foreach (xObjType valueList in valueLists)
            {
                TestObjType      ot  = new TestObjType(valueList);
                TestObjTypeAdmin ota = new TestObjTypeAdmin {
                    ObjectType = ot
                };
                testVault.objTypes.Add(ota);
            }

            List <xWorkflowAdmin> workflows = vaultJson.Workflows;

            foreach (xWorkflowAdmin workflow in workflows)
            {
                //testVault.workflows.Add(new TestWorkflowAdmin(workflow));
                testVault.WorkflowOperations.AddWorkflowAdmin(new TestWorkflowAdmin(workflow));
            }

            return(testVault);
        }
Exemplo n.º 2
0
 public TestObjectClass(TestObjectClassAdmin oClass)
 {
     AssociatedPropertyDefs = new TestAssociatedPropertyDefs();
     foreach (AssociatedPropertyDef associatedPropertyDef in oClass.AssociatedPropertyDefs)
     {
         AssociatedPropertyDefs.Add(-1, associatedPropertyDef);
     }
     AutomaticPermissionsForObjects = oClass.AutomaticPermissionsForObjects;
     ForceWorkflow   = oClass.ForceWorkflow;
     ID              = oClass.ID;
     Name            = oClass.Name;
     NamePropertyDef = oClass.NamePropertyDef;
     ObjectType      = oClass.ObjectType;
     Workflow        = oClass.Workflow;
 }