public void BuildProxyType_AmbigousExplicitInterfaceProperties()
        {
            var knownBaseTypes            = new[] { typeof(ProxiedChild) };
            var knownInterfaceTypes       = new[] { typeof(IProperty), typeof(IPropertyAmbigous2) };
            var knownTypes                = knownBaseTypes.Union(knownInterfaceTypes).ToArray();
            var typeFilter                = new TypeLevelTypeFilter(knownTypes);
            var proxiedType               = typeof(ProxiedChildChild);
            var stableBindingProxyBuilder = new StableBindingProxyBuilder(proxiedType, typeFilter, CreateModuleScope("BuildProxyType_ExplicitInterfaceProperty"));
            var proxyType = stableBindingProxyBuilder.BuildProxyType();

            Assert.That(proxyType.GetInterface("IPropertyAmbigous2"), Is.Not.Null);
            Assert.That(proxyType.GetInterface("IPropertyAmbigous1"), Is.Null);

            // Create proxy instance, initializing it with class to be proxied
            var proxied = new ProxiedChildChild("PC");

            object proxy = Activator.CreateInstance(proxyType, proxied);


            const string expectedPropertyValue = "ProxiedChildChild::IPropertyAmbigous2::PropertyAmbigous PC";

            Assert.That(((IPropertyAmbigous2)proxied).PropertyAmbigous, Is.EqualTo(expectedPropertyValue));

            // Script call to proxy is not ambigous
            Assert.That(ScriptingHelper.ExecuteScriptExpression <string> ("p0.PropertyAmbigous", proxy), Is.EqualTo(expectedPropertyValue));

            //To.ConsoleLine.e ("proxyType.GetAllProperties()", proxyType.GetAllProperties ()).nl ().e (proxyType.GetAllProperties ().Select(pi => pi.Attributes)).nl (2).e ("proxyType.GetAllMethods()", proxyType.GetAllMethods ());

            var proxyPropertyInfo = proxyType.GetProperty(
                "Remotion.Scripting.UnitTests.TestDomain.ProxiedChild.Remotion.Scripting.UnitTests.TestDomain.IPropertyAmbigous2.PropertyAmbigous", _nonPublicInstanceFlags);

            Assert.That(proxyPropertyInfo, Is.Not.Null);
            Assert.That(proxyPropertyInfo.GetValue(proxy, null), Is.EqualTo(expectedPropertyValue));
            //AssertPropertyInfoEqual (proxyPropertyInfo, propertyInfo);

            ((IPropertyAmbigous2)proxied).PropertyAmbigous = "aBc";
            const string expectedPropertyValue2 = "ProxiedChildChild::IPropertyAmbigous2::PropertyAmbigous aBc-ProxiedChildChild::IPropertyAmbigous2::PropertyAmbigous";

            Assert.That(((IPropertyAmbigous2)proxied).PropertyAmbigous, Is.EqualTo(expectedPropertyValue2));
            Assert.That(proxyPropertyInfo.GetValue(proxy, null), Is.EqualTo(expectedPropertyValue2));

            proxyPropertyInfo.SetValue(proxy, "XXyyZZ", null);
            const string expectedPropertyValue3 = "ProxiedChildChild::IPropertyAmbigous2::PropertyAmbigous XXyyZZ-ProxiedChildChild::IPropertyAmbigous2::PropertyAmbigous";

            Assert.That(((IPropertyAmbigous2)proxied).PropertyAmbigous, Is.EqualTo(expectedPropertyValue3));
            Assert.That(proxyPropertyInfo.GetValue(proxy, null), Is.EqualTo(expectedPropertyValue3));

            var proxyPropertyInfo2 = proxyType.GetProperty(
                "Remotion.Scripting.UnitTests.TestDomain.ProxiedChild.Remotion.Scripting.UnitTests.TestDomain.IPropertyAmbigous1.PropertyAmbigous", _nonPublicInstanceFlags);

            Assert.That(proxyPropertyInfo2, Is.Null);
        }
        public void AmbigousExplicitInterfaceProperties_With_Proxy()
        {
            var proxiedType = typeof(ProxiedChildChild);
            var stableBindingProxyBuilder = new StableBindingProxyBuilder(
                proxiedType, new TypeLevelTypeFilter(new[] { typeof(IPropertyAmbigous2) }), CreateModuleScope("AmbigousExplicitInterfaceProperties_With_Proxy"));
            var proxyType = stableBindingProxyBuilder.BuildProxyType();

            var proxied = new ProxiedChildChild("PC");

            object proxy = Activator.CreateInstance(proxyType, proxied);

            // Proxy works, since only IPropertyAmbigous2 is exposed.
            ExecuteScriptAccessPropertyAmbigous(proxy);

            // Proxied fails, since call to PropertyAmbigous is ambigous.
            try
            {
                ExecuteScriptAccessPropertyAmbigous(proxied);
            }
            catch (MissingMemberException e)
            {
                Assert.That(e.Message, Is.EqualTo("'ProxiedChild' object has no attribute 'PropertyAmbigous'"));
            }
        }