Exemplo n.º 1
0
        public void Constructor_BindsValues()
        {
            var appsettings = new Dictionary <string, string> {
                { "test", "myString" }
            };

            var configurationBuilder = new ConfigurationBuilder();

            configurationBuilder.AddInMemoryCollection(appsettings);
            var config = configurationBuilder.Build();

            var sconfig = new TestServiceConfiguration(config);

            Assert.Equal("myString", sconfig.Test);
        }
Exemplo n.º 2
0
        public void Constructor_BindsValues()
        {
            var appsettings = @"
{
    'test': 'myString'
}";

            var    path      = TestHelpers.CreateTempFile(appsettings);
            string directory = Path.GetDirectoryName(path);
            string fileName  = Path.GetFileName(path);

            ConfigurationBuilder configurationBuilder = new ConfigurationBuilder();

            configurationBuilder.SetBasePath(directory);
            configurationBuilder.AddJsonFile(fileName);
            var config = configurationBuilder.Build();

            var sconfig = new TestServiceConfiguration(config);

            Assert.Equal("myString", sconfig.Test);
        }