Ejemplo n.º 1
0
        public void GivenIHaveARunningServer(string serverConfig, string clusterConfig)
        {
            NameValueCollection parameters = new NameValueCollection {
                { "port", GetFreePort().ToString() }
            };

            DarkRiftServerConfigurationBuilder serverConfigurationBuilder = DarkRiftServerConfigurationBuilder.CreateFromXml("Configurations/Server/" + serverConfig, parameters);

#if PRO
            serverConfigurationBuilder.AddPluginType(typeof(InMemoryServerRegistryConnector));

            DarkRiftServer server = new DarkRiftServer(
                serverConfigurationBuilder.ServerSpawnData,
                ClusterSpawnData.CreateFromXml("Configurations/Cluster/" + clusterConfig, new NameValueCollection())
                );
#else
            DarkRiftServer server = new DarkRiftServer(
                serverConfigurationBuilder.ServerSpawnData
                );
#endif

            server.StartServer();

            world.AddServer(server);

#if DEBUG
            // We've just requested a load of objects that wont be returned until we close
            // UDP receive TCP accept
            performanceSteps.ExpectedUnaccountedForSocketAsyncEventArgs += 2;
#endif
        }
        public void TestAddPluginType()
        {
            // GIVEN an empty config builder
            DarkRiftServerConfigurationBuilder builder = DarkRiftServerConfigurationBuilder.Create();

            // WHEN a plugin typer is added
            builder.AddPluginType(typeof(DateTime));

            // THEN the plugin search path is added to the spawn data
            Assert.AreEqual(1, builder.ServerSpawnData.PluginSearch.PluginTypes.Count);
            Assert.AreSame(typeof(DateTime), builder.ServerSpawnData.PluginSearch.PluginTypes[0]);
        }