Пример #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SchemaAttributes"/> class.
 /// </summary>
 /// <param name="name">The name of the property that contains these attributes.</param>
 /// <param name="converter">The converter that defines how to convert from .NET to XLIFF.</param>
 /// <param name="defaultValue">The default .NET value of the property.</param>
 /// <param name="hasValueIndicator">The indicator that defines how to determine if the value has data.</param>
 /// <param name="schema">Defines how to map the property to XLIFF.</param>
 /// <param name="inheritanceList">A list that defines how to inherit the value from ancestors.</param>
 /// <param name="outputDependencies">A list of property names that, when written, must be accompanied by the
 /// property to which this attribute is applied.</param>
 public SchemaAttributes(
     string name,
     ConverterAttribute converter,
     DefaultValueAttribute defaultValue,
     HasValueIndicatorAttribute hasValueIndicator,
     SchemaEntityAttribute schema,
     IEnumerable<InheritValueAttribute> inheritanceList,
     IEnumerable<ExplicitOutputDependencyAttribute> outputDependencies)
 {
     this.Converter = converter;
     this.DefaultValue = defaultValue;
     this.ExplicitOutputDependencies = new List<ExplicitOutputDependencyAttribute>(outputDependencies);
     this.HasValueIndicator = hasValueIndicator;
     this.InheritanceList = new List<InheritValueAttribute>(inheritanceList);
     this.Name = name;
     this.Schema = schema;
 }
        public void ConverterAttribute_Ctor()
        {
            ConverterAttribute instance;

            //
            // Test with null type.
            //

            try
            {
                instance = new ConverterAttribute(null);
                Assert.Fail("Expected ArgumentNullException to be thrown.");
            }
            catch (ArgumentNullException)
            {
            }

            //
            // Test with valid type.
            //

            instance = new ConverterAttribute(typeof(bool));
            Assert.AreEqual(typeof(bool).FullName, instance.TypeName, "Name was not set properly.");
        }