Exemplo n.º 1
0
        public void Should_be_possible_to_create_a_instance_of_EntityBaseType_based_on_another_EntityBaseType()
        {
            EntityObjectStringType entitySource = new EntityObjectStringType()
            {
                datatype  = Common.SimpleDatatypeEnumeration.@string,
                operation = Common.OperationEnumeration.equals,
                Value     = "file.txt"
            };
            EntityBaseTypeFactory  factory   = new EntityBaseTypeFactory();
            EntityObjectStringType newEntity = factory.CreateEntityBasedOn <EntityObjectStringType>(entitySource);

            Assert.IsNotNull(newEntity);
            Assert.IsInstanceOfType(newEntity, typeof(EntityObjectStringType));
            Assert.AreEqual(Common.SimpleDatatypeEnumeration.@string, newEntity.datatype);
            Assert.AreEqual(Common.OperationEnumeration.equals, newEntity.operation);
            Assert.AreEqual("file.txt", newEntity.Value);

            EntityObjectBoolType entityBoolSource = new EntityObjectBoolType()
            {
                datatype  = Common.SimpleDatatypeEnumeration.boolean,
                operation = Common.OperationEnumeration.notequal,
                var_ref   = "oval:modulo:19"
            };

            EntityObjectBoolType newEntityBoolType = factory.CreateEntityBasedOn <EntityObjectBoolType>(entityBoolSource);

            Assert.IsNotNull(newEntityBoolType);
            Assert.IsInstanceOfType(newEntityBoolType, typeof(EntityObjectBoolType));
        }
Exemplo n.º 2
0
        private ObjectType CreateObjectTypeFrom(fileeffectiverights_object fileEffectiveRights, string path, string fileName, string trustee_name)
        {
            EntityObjectStringType fileNameFrom     = (EntityObjectStringType)fileEffectiveRights.GetItemValue(fileeffectiverights_object_ItemsChoices.filename);
            EntityObjectStringType pathFrom         = (EntityObjectStringType)fileEffectiveRights.GetItemValue(fileeffectiverights_object_ItemsChoices.path);
            EntityObjectStringType trustee_nameFrom = (EntityObjectStringType)fileEffectiveRights.GetItemValue(fileeffectiverights_object_ItemsChoices.trustee_name);

            EntityObjectStringType newFileName = entityBaseTypeFactory.CreateEntityBasedOn <EntityObjectStringType>(fileNameFrom);

            newFileName.Value = !string.IsNullOrEmpty(fileName) ? fileName : newFileName.Value;
            EntityObjectStringType newPath = entityBaseTypeFactory.CreateEntityBasedOn <EntityObjectStringType>(pathFrom);

            newPath.Value = !string.IsNullOrEmpty(path) ? path : newPath.Value;
            EntityObjectStringType newTrustee_name = entityBaseTypeFactory.CreateEntityBasedOn <EntityObjectStringType>(trustee_nameFrom);

            newTrustee_name.Value = !string.IsNullOrEmpty(trustee_name) ? trustee_name : newTrustee_name.Value;

            return(this.CreateFileEffectiveRights(newFileName, newPath, newTrustee_name));
        }
Exemplo n.º 3
0
        public void Should_be_possible_to_create_a_instance_of_EntityBaseType_based_on_another_EntityBaseType()
        {
            EntityObjectStringType entitySource = new EntityObjectStringType()
            {
                datatype = Common.SimpleDatatypeEnumeration.@string,
                operation = Common.OperationEnumeration.equals,
                Value = "file.txt"
            };
            EntityBaseTypeFactory factory = new EntityBaseTypeFactory();
            EntityObjectStringType newEntity = factory.CreateEntityBasedOn<EntityObjectStringType>(entitySource);

            Assert.IsNotNull(newEntity);
            Assert.IsInstanceOfType(newEntity,typeof(EntityObjectStringType));
            Assert.AreEqual(Common.SimpleDatatypeEnumeration.@string, newEntity.datatype);
            Assert.AreEqual(Common.OperationEnumeration.equals, newEntity.operation);
            Assert.AreEqual("file.txt", newEntity.Value);

            EntityObjectBoolType entityBoolSource = new EntityObjectBoolType()
            {
                datatype = Common.SimpleDatatypeEnumeration.boolean,
                operation = Common.OperationEnumeration.notequal,
                var_ref = "oval:modulo:19"
            };
            
            EntityObjectBoolType newEntityBoolType = factory.CreateEntityBasedOn<EntityObjectBoolType>(entityBoolSource);
            
            Assert.IsNotNull(newEntityBoolType);
            Assert.IsInstanceOfType(newEntityBoolType, typeof(EntityObjectBoolType));



        }
Exemplo n.º 4
0
 private EntityObjectStringType CreateObjectStringTypeFrom(EntityObjectStringType objectStringType)
 {
     EntityBaseTypeFactory factory = new EntityBaseTypeFactory();
     return factory.CreateEntityBasedOn<EntityObjectStringType>(objectStringType);           
 }
Exemplo n.º 5
0
        private EntityObjectStringType CreateObjectStringTypeFrom(EntityObjectStringType objectStringType)
        {
            EntityBaseTypeFactory factory = new EntityBaseTypeFactory();

            return(factory.CreateEntityBasedOn <EntityObjectStringType>(objectStringType));
        }