Exemplo n.º 1
0
        public void NonPublicStructVirtualProxyTest()
        {
            PrivateStruct       instance = default;
            VirtualPrivateProxy proxy    = instance.DuckCast <VirtualPrivateProxy>();

            Assert.Equal(instance.Value, proxy.Value);
        }
Exemplo n.º 2
0
        public void NonPublicStructInterfaceProxyTest()
        {
            PrivateStruct  instance = default;
            IPrivateStruct proxy    = instance.DuckCast <IPrivateStruct>();

            Assert.Equal(instance.Value, proxy.Value);
        }
Exemplo n.º 3
0
        public void NonPublicStructCopyTest()
        {
            PrivateStruct instance = default;
            CopyStruct    copy     = instance.DuckCast <CopyStruct>();

            Assert.Equal(instance.Value, copy.Value);
        }
Exemplo n.º 4
0
        public void NonPublicStructVirtualProxyTest()
        {
            PrivateStruct       instance = default;
            VirtualPrivateProxy proxy    = instance.DuckCast <VirtualPrivateProxy>();

            Assert.Equal((int)instance.Value, (int)proxy.Value);
            Assert.Equal(ValuesDuckType.Third.ToString(), proxy.GetValue());
            Assert.Equal(ValuesDuckType.Third.ToString(), ((IGetValue)proxy).GetValueProp);
        }
Exemplo n.º 5
0
        public void NonPublicStructInterfaceProxyTest()
        {
            PrivateStruct  instance = default;
            IPrivateStruct proxy    = instance.DuckCast <IPrivateStruct>();

            Assert.Equal((int)instance.Value, (int)proxy.Value);
            Assert.Equal(ValuesDuckType.Third.ToString(), proxy.GetValue());
            Assert.Equal(ValuesDuckType.Third.ToString(), proxy.GetValueProp);
        }
Exemplo n.º 6
0
        public void NonPublicStructCopyTest()
        {
            PrivateStruct instance = default;
            CopyStruct    copy     = instance.DuckCast <CopyStruct>();

            Assert.Equal((int)instance.Value, (int)copy.Value);
            Assert.Equal(ValuesDuckType.Third.ToString(), copy.GetValue());
            Assert.Equal(ValuesDuckType.Third.ToString(), ((IGetValue)copy).GetValueProp);
        }
        public void NonPublicStructAbstractProxyTest()
        {
            PrivateStruct        instance = default;
            AbstractPrivateProxy proxy    = instance.DuckCast <AbstractPrivateProxy>();

            Assert.Equal((int)instance.Value, (int)proxy.Value);
            Assert.Equal(ValuesDuckType.Third.ToString(), proxy.GetValue());
            Assert.Equal(ValuesDuckType.Third.ToString(), ((IGetValue)proxy).GetValueProp);
            Assert.Equal(42, proxy.GetAnswerToMeaningOfLife());
        }