Exemplo n.º 1
0
        public void TestListenEndPointReplacement()
        {
            CreateBootstrap("Basic.config");

            var endPointReplacement = new Dictionary <string, IPEndPoint>(StringComparer.OrdinalIgnoreCase);

            endPointReplacement.Add("TestServer_2012", new IPEndPoint(IPAddress.Any, 3012));

            BootStrap.Initialize(endPointReplacement);

            var appServer = BootStrap.AppServers.OfType <IAppServer>().FirstOrDefault();

            Assert.AreEqual(1, appServer.Listeners.Length);

            Assert.AreEqual(3012, appServer.Listeners[0].EndPoint.Port);

            CreateBootstrap("Listeners.config");

            endPointReplacement = new Dictionary <string, IPEndPoint>(StringComparer.OrdinalIgnoreCase);
            endPointReplacement.Add("TestServer_2012", new IPEndPoint(IPAddress.Any, 3012));
            endPointReplacement.Add("TestServer_2013", new IPEndPoint(IPAddress.Any, 3013));

            BootStrap.Initialize(endPointReplacement);

            appServer = BootStrap.AppServers.OfType <IAppServer>().FirstOrDefault();

            Assert.AreEqual(2, appServer.Listeners.Length);

            Assert.AreEqual(3012, appServer.Listeners[0].EndPoint.Port);
            Assert.AreEqual(3013, appServer.Listeners[1].EndPoint.Port);
        }
Exemplo n.º 2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            BootStrap.Initialize(services);

            services.AddControllers()
            .AddNewtonsoftJson(
                options => options.SerializerSettings.Culture = CultureInfo.CurrentCulture
                );

            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new OpenApiInfo {
                    Title = "Chatbot", Version = "v1"
                });
            });
        }