Exemplo n.º 1
0
        public void Constructor_SetsValues()
        {
            var profiles  = new List <string>();
            var propDescs = new List <PropertySourceDescriptor>();
            var desc      = new EnvironmentDescriptor(profiles, propDescs);

            Assert.Same(profiles, desc.ActiveProfiles);
            Assert.Same(propDescs, desc.PropertySources);
        }
Exemplo n.º 2
0
        public void JsonSerialization_ReturnsExpected()
        {
            var profiles = new List <string>()
            {
                "foobar"
            };
            var properties = new Dictionary <string, PropertyValueDescriptor>()
            {
                { "key1", new PropertyValueDescriptor("value") },
                { "key2", new PropertyValueDescriptor(false) },
            };
            var propDescs = new List <PropertySourceDescriptor>()
            {
                new PropertySourceDescriptor("name", properties)
            };
            var desc   = new EnvironmentDescriptor(profiles, propDescs);
            var result = Serialize(desc);

            Assert.Equal("{\"activeProfiles\":[\"foobar\"],\"propertySources\":[{\"properties\":{\"key1\":{\"value\":\"value\"},\"key2\":{\"value\":false}},\"name\":\"name\"}]}", result);
        }