public void DefaultParser_RedirectDetails_InvalidXml()
 {
     DefaultInAnotherCastleParser parser = new DefaultInAnotherCastleParser();
     //missing CacheDurationInMinutes
     string xml     = @"<MissingAllRequiredAttributes></MissingAllRequiredAttributes>";
     var    results = parser.ParseRedirectDetails(xml);
 }
        public void DefaultParser_StandardConfigSection_ValidXmlForConfig_ExpectedInstanceReturned()
        {
            DefaultInAnotherCastleParser parser = new DefaultInAnotherCastleParser();
            var results = parser.StandardConfigSectionParse(@"<TestInvalid Name=""TestName"" Value=""TestValue""></TestInvalid>", typeof(ExampleConfigurationSection));

            results.WithDeepEqual(new
            {
                Name  = "TestName",
                Value = "TestValue"
            }).IgnoreUnmatchedProperties().Assert();
        }
        public void DefaultParser_PocoConfig_ValidXml_ExpectedInstanceReturned()
        {
            DefaultInAnotherCastleParser parser = new DefaultInAnotherCastleParser();
            var results = parser.POCOConfigSectionParse(@"<ExampleConfigurationPoco Name=""TestName"" Value=""TestValue""></ExampleConfigurationPoco>", typeof(ExampleConfigurationPoco));

            results.WithDeepEqual(new ExampleConfigurationPoco
            {
                Name  = "TestName",
                Value = "TestValue"
            }).IgnoreUnmatchedProperties().Assert();
        }
        public void DefaultParserT_RedirectDetails_ValidXml()
        {
            DefaultInAnotherCastleParser parser = new DefaultInAnotherCastleParser();
            //missing CacheDurationInMinutes
            string xml     = @"<InAnotherCastleConfigSectionRedirect Mode=""Standard"" Name=""TestName"" SystemName=""SystemNameTest"" Type=""TestType""  CacheDurationInMinutes=""100"" ></InAnotherCastleConfigSectionRedirect>";
            var    results = parser.ParseRedirectDetails(xml);

            results.WithDeepEqual(new MockRedirectIdentifier()
            {
                CacheDurationInMinutes = 100,
                Name       = "TestName",
                Type       = "TestType",
                SystemName = "SystemNameTest",
                Mode       = Mode.Standard,
                PocoBody   = new PocoBody()
            }).IgnoreUnmatchedProperties().Assert();
        }
        public void DefaultParser_StandardConfigSection_InvalidXmlForConfig_ConfigurationExceptionThrown()
        {
            DefaultInAnotherCastleParser parser = new DefaultInAnotherCastleParser();

            parser.StandardConfigSectionParse("<TestInvalid></TestInvalid>", typeof(ExampleConfigurationSection));
        }
 public void DefaultParser_PocoConfig_InvalidXml_ConfigurationExceptionThrown()
 {
     DefaultInAnotherCastleParser parser = new DefaultInAnotherCastleParser();
     var results = parser.POCOConfigSectionParse(@"<TestInvalid SomeUnknownProperty=""TestName"" SomeUnknownProperty2=""TestValue""></TestInvalid>", typeof(ExampleConfigurationPoco));
 }
Exemple #7
0
 public InAnotherCastleHandler()
 {
     //TODO move to config
     Parser = new DefaultInAnotherCastleParser();
 }