Example #1
0
        public void NonPublicStructVirtualProxyTest()
        {
            PrivateStruct       instance = default;
            VirtualPrivateProxy proxy    = instance.DuckCast <VirtualPrivateProxy>();

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

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

            Assert.Equal(instance.Value, copy.Value);
        }
        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);
        }
        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 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);
            Assert.Equal(42, proxy.GetAnswerToMeaningOfLife());
        }