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)); }
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); }
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); }
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); }