示例#1
0
        public static IEnumerable <object[]> GetNativeVariantForObject_WrappedComObject_TestData()
        {
            var empty        = new ComImportObject();
            var dual         = new DualComObject();
            var iUnknown     = new IUnknownComObject();
            var iDispatch    = new IDispatchComObject();
            var iInspectable = new IInspectableComObject();
            var nonDual      = new NonDualComObject();
            var autoDispatch = new AutoDispatchComObject();
            var autoDual     = new AutoDualComObject();

            yield return(new object[] { new UnknownWrapper(empty), empty, VarEnum.VT_UNKNOWN });

            yield return(new object[] { new UnknownWrapper(dual), dual, VarEnum.VT_UNKNOWN });

            yield return(new object[] { new UnknownWrapper(iUnknown), iUnknown, VarEnum.VT_UNKNOWN });

            yield return(new object[] { new UnknownWrapper(iDispatch), iDispatch, VarEnum.VT_UNKNOWN });

            yield return(new object[] { new UnknownWrapper(iInspectable), iInspectable, VarEnum.VT_UNKNOWN });

            yield return(new object[] { new UnknownWrapper(nonDual), nonDual, VarEnum.VT_UNKNOWN });

            yield return(new object[] { new UnknownWrapper(autoDispatch), autoDispatch, VarEnum.VT_UNKNOWN });

            yield return(new object[] { new UnknownWrapper(autoDual), autoDual, VarEnum.VT_UNKNOWN });

            if (!PlatformDetection.IsNetCore)
            {
                yield return(new object[] { new DispatchWrapper(empty), empty, VarEnum.VT_DISPATCH });

                yield return(new object[] { new DispatchWrapper(dual), dual, VarEnum.VT_DISPATCH });

                yield return(new object[] { new DispatchWrapper(iUnknown), iUnknown, VarEnum.VT_DISPATCH });

                yield return(new object[] { new DispatchWrapper(iDispatch), iDispatch, VarEnum.VT_DISPATCH });

                yield return(new object[] { new DispatchWrapper(iInspectable), iInspectable, VarEnum.VT_DISPATCH });

                yield return(new object[] { new DispatchWrapper(nonDual), nonDual, VarEnum.VT_DISPATCH });

                yield return(new object[] { new DispatchWrapper(autoDispatch), autoDispatch, VarEnum.VT_DISPATCH });

                yield return(new object[] { new DispatchWrapper(autoDual), autoDual, VarEnum.VT_DISPATCH });
            }
            else
            {
                Assert.Throws <PlatformNotSupportedException>(() => new DispatchWrapper(10));
            }
        }
        public static IEnumerable <object[]> GetNativeVariantForObject_WrappedComObject_TestData()
        {
            var empty        = new ComImportObject();
            var dual         = new DualComObject();
            var iUnknown     = new IUnknownComObject();
            var iDispatch    = new IDispatchComObject();
            var iInspectable = new IInspectableComObject();
            var nonDual      = new NonDualComObject();
            var autoDispatch = new AutoDispatchComObject();
            var autoDual     = new AutoDualComObject();

            yield return(new object[] { new UnknownWrapper(empty), empty, VarEnum.VT_UNKNOWN });

            yield return(new object[] { new UnknownWrapper(dual), dual, VarEnum.VT_UNKNOWN });

            yield return(new object[] { new UnknownWrapper(iUnknown), iUnknown, VarEnum.VT_UNKNOWN });

            yield return(new object[] { new UnknownWrapper(iDispatch), iDispatch, VarEnum.VT_UNKNOWN });

            yield return(new object[] { new UnknownWrapper(iInspectable), iInspectable, VarEnum.VT_UNKNOWN });

            yield return(new object[] { new UnknownWrapper(nonDual), nonDual, VarEnum.VT_UNKNOWN });

            yield return(new object[] { new UnknownWrapper(autoDispatch), autoDispatch, VarEnum.VT_UNKNOWN });

            yield return(new object[] { new UnknownWrapper(autoDual), autoDual, VarEnum.VT_UNKNOWN });

            yield return(new object[] { new DispatchWrapper(empty), empty, VarEnum.VT_DISPATCH });

            yield return(new object[] { new DispatchWrapper(dual), dual, VarEnum.VT_DISPATCH });

            yield return(new object[] { new DispatchWrapper(iUnknown), iUnknown, VarEnum.VT_DISPATCH });

            yield return(new object[] { new DispatchWrapper(iDispatch), iDispatch, VarEnum.VT_DISPATCH });

            yield return(new object[] { new DispatchWrapper(iInspectable), iInspectable, VarEnum.VT_DISPATCH });

            yield return(new object[] { new DispatchWrapper(nonDual), nonDual, VarEnum.VT_DISPATCH });

            yield return(new object[] { new DispatchWrapper(autoDispatch), autoDispatch, VarEnum.VT_DISPATCH });

            yield return(new object[] { new DispatchWrapper(autoDual), autoDual, VarEnum.VT_DISPATCH });
        }