示例#1
0
        protected override ConfigurationElement CreateNewElement()
        {
            var element = new ParameterElement(_nextKey);

            _nextKey++;
            return(element);
        }
示例#2
0
        protected override ConfigurationElement CreateNewElement()
        {
            ParameterElement parameterElement = new ParameterElement(this._nextKey);

            ++this._nextKey;
            return((ConfigurationElement)parameterElement);
        }
 public void ParameterElement_converts_to_valid_type()
 {
     var param = new ParameterElement(0)
                     {
                         ValueString = "2",
                         TypeName = "System.Int32"
                     };
     Assert.Equal(2, param.GetTypedParameterValue());
 }
 public void ParameterElement_throws_converting_to_incompatible_type()
 {
     var param = new ParameterElement(0)
                     {
                         ValueString = "MyValue",
                         TypeName = "System.Int32"
                     };
     Assert.Throws<FormatException>(() => param.GetTypedParameterValue());
 }
 public void ParameterElement_throws_converting_to_invalid_type()
 {
     var param = new ParameterElement(0)
                     {
                         ValueString = "MyValue",
                         TypeName = "Not.A.Type"
                     };
     Assert.True(Assert.Throws<TypeLoadException>(() => param.GetTypedParameterValue()).Message.Contains(" 'Not.A.Type' "));
 }
 protected override ConfigurationElement CreateNewElement()
 {
     var element = new ParameterElement(_nextKey);
     _nextKey++;
     return element;
 }