示例#1
0
        public static TServer CreateFromXml <TServer, TOptions>(XNode xServer)
            where TServer : IServer//, new()
            where TOptions : IServerOptions
        {
            TServer server = Activator.CreateInstance <TServer>();

            //T server = new T();
            server.Options = BaseServerOptions.CreateFromXml <TOptions>(xServer);
            return(server);
        }
        public void CreateFromXmlTest()
        {
            XNode             xServer  = xServerForTest;                // TODO: Initialize to an appropriate value
            BaseServerOptions expected = new GoldSourceServerOptions(); // TODO: Initialize to an appropriate value
            BaseServerOptions actual;

            actual = BaseServerOptions.CreateFromXml <GoldSourceServerOptions>(xServer);
            Assert.AreEqual(expected.CommandLine(), actual.CommandLine());
            //Assert.Inconclusive("No appropriate type parameter is found to satisfies the type constraint(s) of T. " +
            //        "Please call CreateFromXmlTestHelper<T>() with appropriate type parameters.");
        }
        public void GetXmlTest()
        {
            BaseServerOptions target   = CreateBaseServerOptions(); // TODO: Initialize to an appropriate value
            XNode             expected = xServerForTest;            // TODO: Initialize to an appropriate value
            XNode             actual;

            actual = target.GetXml();
            //if (expected.Value != actual.Value)
            //{
            //    Assert.Fail();
            //}
            Assert.AreEqual(expected.ToString(), actual.ToString());
            //Assert.Inconclusive("Verify the correctness of this test method.");
        }