Ejemplo n.º 1
0
        public void TryAutoResolveValue_UnresolvedValue_ThrowsExpectedException()
        {
            var resolver  = new FakeNameResolver();
            var attribute = new Attr2(string.Empty, string.Empty)
            {
                ResolvedSetting = "MySetting"
            };
            var    prop          = attribute.GetType().GetProperty("ResolvedSetting");
            var    attr          = prop.GetCustomAttribute <AppSettingAttribute>();
            string resolvedValue = "MySetting";

            var ex = Assert.Throws <InvalidOperationException>(() => AttributeCloner <Attr2> .GetConfigurationResolver(resolvedValue, attr.Default, prop, skipValidation, s => _emptyConfig[s]));

            Assert.Contains("Unable to resolve the value for property 'Attr2.ResolvedSetting'.", ex.Message);
        }