Пример #1
0
        public void LoadInAnotherCastleConfigSection_MissingRequiredFieldsXml_ConfigurationExceptionThrown()
        {
            InAnotherCastleConfigSection section = new InAnotherCastleConfigSection();
            //missing ServiceProviderType
            string xml = @"<InAnotherCastleConfigSection></InAnotherCastleConfigSection>";

            using (StringReader stringReader = new StringReader(xml))
                using (XmlReader reader = XmlReader.Create(stringReader))
                {
                    section.ExposedDeserializeSection(reader);
                }
        }
Пример #2
0
        public void LoadInAnotherCastleConfigSection_ValidXml_ProperObjectReturned()
        {
            InAnotherCastleConfigSection section = new InAnotherCastleConfigSection();
            string xml = @"<InAnotherCastleConfigSection ServiceProviderType=""TestType""></InAnotherCastleConfigSection>";

            using (StringReader stringReader = new StringReader(xml))
                using (XmlReader reader = XmlReader.Create(stringReader))
                {
                    section.ExposedDeserializeSection(reader);
                }
            section.WithDeepEqual(new MockInAnotherCastleConfigurationSection()
            {
                ServiceProviderTypeName = "TestType"
            }).IgnoreUnmatchedProperties().Assert();
        }