Ejemplo n.º 1
0
        internal static ServerConfig Create(XmlNode serverConfigNode)
        {
            if ((serverConfigNode == null) || (serverConfigNode.Name != "WebServer"))
            {
                throw new ArgumentException("Invalid configuration XML");
            }

            var handler = new ServerConfigurationHandler();

            return((ServerConfig)handler.Create(null, null, serverConfigNode));
        }
Ejemplo n.º 2
0
        public void HandlersParsed()
        {
            ServerConfigurationHandler target = new ServerConfigurationHandler(); // TODO: Initialize to an appropriate value
            object       parent        = null;                                    // TODO: Initialize to an appropriate value
            object       configContext = null;                                    // TODO: Initialize to an appropriate value
            ServerConfig actual;
            XmlDocument  d = new XmlDocument();

            d.LoadXml("<?xml version=\"1.0\" encoding=\"utf-8\" ?><WebServer><httpHandlers><add verb=\"*\" path=\"xyz\" type=\"System.String\"/></httpHandlers></WebServer>");

            actual = target.Create(parent, configContext, d.SelectSingleNode("WebServer")) as ServerConfig;

            Assert.AreEqual(1, actual.HttpHandlers.Count);
        }
Ejemplo n.º 3
0
        public void CreateRest()
        {
            ServerConfigurationHandler target = new ServerConfigurationHandler(); // TODO: Initialize to an appropriate value
            object       parent        = null;
            object       configContext = null;
            ServerConfig actual;
            XmlDocument  d = new XmlDocument();

            d.LoadXml("<?xml version=\"1.0\" encoding=\"utf-8\" ?><WebServer><restServices/></WebServer>");

            actual = target.Create(parent, configContext, d.SelectSingleNode("WebServer")) as ServerConfig;

            Assert.IsNotNull(actual.Rest);
        }
Ejemplo n.º 4
0
        public void EmptyHandlers()
        {
            ServerConfigurationHandler target = new ServerConfigurationHandler(); // TODO: Initialize to an appropriate value
            object       parent        = null;                                    // TODO: Initialize to an appropriate value
            object       configContext = null;                                    // TODO: Initialize to an appropriate value
            ServerConfig actual;
            XmlDocument  d = new XmlDocument();

            d.LoadXml("<?xml version=\"1.0\" encoding=\"utf-8\" ?><WebServer/>");

            actual = target.Create(parent, configContext, d.SelectSingleNode("WebServer")) as ServerConfig;

            Assert.AreEqual(0, actual.HttpHandlers.Count);
        }