public void Then_DeserializingWithParametersAndValueChildrenThrows()
        {
            var elementXml = @"
                <property name=""connectionString"" value=""northwind2"">
                    <value value=""northwind"" />
                </property>";

            var reader  = new XmlTextReader(new StringReader(elementXml));
            var result  = reader.MoveToContent();
            var element = new PropertyElement();

            element.Deserialize(reader);
        }
        public void Then_CanDeserializeSingleInjectionValueChild()
        {
            var elementXml = @"
                <property name=""connectionString"">
                    <value value=""northwind"" />
                </property>";

            var reader  = new XmlTextReader(new StringReader(elementXml));
            var result  = reader.MoveToContent();
            var element = new PropertyElement();

            element.Deserialize(reader);

            Assert.AreSame(typeof(ValueElement), element.Value.GetType());
            Assert.AreEqual("northwind", ((ValueElement)element.Value).Value);
        }
        public void Then_CanDeserializeSingleInjectionValueChild()
        {
            var elementXml = @"
                <property name=""connectionString"">
                    <value value=""northwind"" />
                </property>";

            var reader = new XmlTextReader(new StringReader(elementXml));
            var result = reader.MoveToContent();
            var element = new PropertyElement();

            element.Deserialize(reader);

            Assert.AreSame(typeof(ValueElement), element.Value.GetType());
            Assert.AreEqual("northwind", ((ValueElement)element.Value).Value);
        }
示例#4
0
        public void Then_DeserializingMultipleInjectionValueChildrenThrows()
        {
            var elementXml = @"
                <property name=""connectionString"">
                    <value value=""northwind"" />
                    <value value=""northwind"" />
                </property>";

            var reader  = new XmlTextReader(new StringReader(elementXml));
            var result  = reader.MoveToContent();
            var element = new PropertyElement();

            AssertExtensions.AssertException <ConfigurationErrorsException>(() =>
            {
                element.Deserialize(reader);
            });
        }
        public void Then_DeserializingMultipleInjectionValueChildrenThrows()
        {
            var elementXml = @"
                <property name=""connectionString"">
                    <value value=""northwind"" />
                    <value value=""northwind"" />
                </property>";

            var reader = new XmlTextReader(new StringReader(elementXml));
            var result = reader.MoveToContent();
            var element = new PropertyElement();
            AssertExtensions.AssertException<ConfigurationErrorsException>(() =>
                {
                    element.Deserialize(reader);
                });
        }
        public void Then_DeserializingWithParametersAndValueChildrenThrows()
        {
            var elementXml = @"
                <property name=""connectionString"" value=""northwind2"">
                    <value value=""northwind"" />
                </property>";

            var reader = new XmlTextReader(new StringReader(elementXml));
            var result = reader.MoveToContent();
            var element = new PropertyElement();

            element.Deserialize(reader);
        }