Example #1
0
        public void PProxyListDefaultBehavior_can_apply_default_behavior_to_throw_FallthroughException_against_one_instance()
        {
            // Arrange
            IndirectionsContext.
            ExcludeGeneric().
            Include(PList <int> .AddT()).
            DefaultBehavior = IndirectionBehaviors.NotImplemented;

            var proxy = new PProxyList <int>();

            proxy.
            ExcludeGeneric().
            IncludeAddT().
            DefaultBehavior = IndirectionBehaviors.Fallthrough;
            LooseCrossDomainAccessor.GetOrRegister <GenericHolder <IndirectionAction <List <int>, int> > >().Source = proxy.AddT().Body;
            LooseCrossDomainAccessor.GetOrRegister <GenericHolder <List <int> > >().Source = (List <int>)proxy;


            // Act
            var addTarget = LooseCrossDomainAccessor.GetOrRegister <GenericHolder <IndirectionAction <List <int>, int> > >().Source;
            var target    = LooseCrossDomainAccessor.GetOrRegister <GenericHolder <List <int> > >().Source;
            var addOther  = PList <int> .AddT().Body;


            // Assert
            Assert.Throws <FallthroughException>(() => addTarget(target, 0));
            Assert.Throws <NotImplementedException>(() => addTarget(new List <int>(), 0));
            Assert.Throws <NotImplementedException>(() => addOther(null, 0));
        }
Example #2
0
 public InstanceBehaviorSetting(PProxyList <T> @this)
 {
     m_this = @this;
 }