Ejemplo n.º 1
0
 /// <summary>
 /// Parse the specified configuration settings
 /// </summary>
 /// <param name="element">Element holding configuration settings</param>
 protected override void ParseFromXml(XElement element)
 {
     Name           = element.NonWhiteSpaceStringAttribute(NAME);
     ProcessorType  = element.NonWhiteSpaceStringAttribute(PROCESSOR_TYPE);
     TaskType       = element.TypeAttribute(TASK_TYPE);
     ArgumentType   = element.OptionalTypeAttribute(ARGUMENT_TYPE);
     ResultType     = element.OptionalTypeAttribute(RESULT_TYPE);
     PeekPolicyType = element.OptionalTypeAttribute(PEEK_POLICY);
     InstanceCount  = element.OptionalIntAttribute(INSTANCE_COUNT, 1);
     element.ProcessOptionalElement(EXECUTION_CONTEXT,
                                    item => Context = new TaskExecutionContextSettings(item));
     element.ProcessOptionalElement(PROPERTIES, item => _propertysSettings.ReadFromXml(item));
 }
        public void ConstructorWorksWithNullRootName()
        {
            // --- Act
            var collection1 = new PropertySettingsCollection(
                new List<PropertySettings>
                    {
                        new PropertySettings("Prop1", "2"),
                        new PropertySettings("Prop2", "hello")
                    });
            var element1 = collection1.WriteToXml("Test");

            var collection2 = new PropertySettingsCollection();
            collection2.ReadFromXml(element1);

            // --- Assert
            element1.Elements("Property").ShouldHaveCountOf(2);
            collection2.ShouldHaveCountOf(2);
        }
Ejemplo n.º 3
0
        public void ConstructorWorksWithNullRootName()
        {
            // --- Act
            var collection1 = new PropertySettingsCollection(
                new List <PropertySettings>
            {
                new PropertySettings("Prop1", "2"),
                new PropertySettings("Prop2", "hello")
            });
            var element1 = collection1.WriteToXml("Test");

            var collection2 = new PropertySettingsCollection();

            collection2.ReadFromXml(element1);

            // --- Assert
            element1.Elements("Property").ShouldHaveCountOf(2);
            collection2.ShouldHaveCountOf(2);
        }