From bfad32f22321117e6044f3a666a935ab9adc60b2 Mon Sep 17 00:00:00 2001 From: Kristian Hellang Date: Mon, 7 Dec 2015 15:22:39 +0100 Subject: [PATCH] Added test for Addresses --- .../KestrelServerInformationTests.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/Microsoft.AspNet.Server.KestrelTests/KestrelServerInformationTests.cs b/test/Microsoft.AspNet.Server.KestrelTests/KestrelServerInformationTests.cs index 5a167adf27..2a3285da9f 100644 --- a/test/Microsoft.AspNet.Server.KestrelTests/KestrelServerInformationTests.cs +++ b/test/Microsoft.AspNet.Server.KestrelTests/KestrelServerInformationTests.cs @@ -43,6 +43,25 @@ namespace Microsoft.AspNet.Server.KestrelTests Assert.Equal(expected, information.ThreadCount); } + [Fact] + public void SetAddressesUsingConfiguration() + { + var expected = new List { "http://localhost:1337", "https://localhost:42" }; + + var values = new Dictionary + { + { "server.urls", string.Join(";", expected) } + }; + + var configuration = new ConfigurationBuilder() + .AddInMemoryCollection(values) + .Build(); + + var information = new KestrelServerInformation(configuration); + + Assert.Equal(expected, information.Addresses); + } + private static int Clamp(int value, int min, int max) { return value < min ? min : value > max ? max : value;