示例#1
0
        public static void RunTest()
        {
            IBindingProjectionsTesting target = (IBindingProjectionsTesting)WinRTNativeComponent.GetObjectFromNativeComponent("Component.Contracts.BindingProjectionsTesting");

            using (target.InitializeXamlFrameworkForCurrentThread())
            {
                IBindingViewModel vm = target.CreateViewModel();
                RunINotifyPropertyChangedTest(vm);
                RunINotifyCollectionChangedTest(vm);
            }
        }
示例#2
0
        public static void RunTest()
        {
            Component.Contracts.IStringTesting target = (Component.Contracts.IStringTesting)WinRTNativeComponent.GetObjectFromNativeComponent("Component.Contracts.StringTesting");
            string left  = "Hello C++/WinRT";
            string right = " from .NET Core";

            Assert.AreEqual(string.Concat(left, right), target.ConcatStrings(left, right));
        }
示例#3
0
 public static void RunTest()
 {
     Component.Contracts.IBooleanTesting target = (Component.Contracts.IBooleanTesting)WinRTNativeComponent.GetObjectFromNativeComponent("Component.Contracts.BooleanTesting");
     Assert.IsTrue(target.And(true, true));
     Assert.IsFalse(target.And(false, true));
 }
示例#4
0
        public static void RunTest()
        {
            Component.Contracts.IUriTesting target = (Component.Contracts.IUriTesting)WinRTNativeComponent.GetObjectFromNativeComponent("Component.Contracts.UriTesting");
            Uri managedUri = new Uri("https://dot.net");

            Assert.AreEqual(managedUri.ToString(), target.GetFromUri(managedUri));
            Assert.AreEqual(managedUri, target.CreateUriFromString(managedUri.ToString()));
        }
示例#5
0
 public static void RunTest()
 {
     Component.Contracts.INullableTesting target = (Component.Contracts.INullableTesting)WinRTNativeComponent.GetObjectFromNativeComponent("Component.Contracts.NullableTesting");
     Assert.IsTrue(target.IsNull(null));
     Assert.IsFalse(target.IsNull(5));
     Assert.AreEqual(5, target.GetIntValue(5));
 }
示例#6
0
        public static void RunTest()
        {
            Component.Contracts.IExceptionTesting target = (Component.Contracts.IExceptionTesting)WinRTNativeComponent.GetObjectFromNativeComponent("Component.Contracts.ExceptionTesting");

            Assert.Throws <InvalidOperationException>(() => target.ThrowException(new InvalidOperationException()));

            Assert.OfType <ArgumentOutOfRangeException>(target.GetException(new ArgumentOutOfRangeException().HResult));
            Assert.OfType <NullReferenceException>(target.GetException(new ArgumentNullException().HResult));
            Assert.OfType <NullReferenceException>(target.GetException(new NullReferenceException().HResult));
        }
示例#7
0
        public static void RunTest()
        {
            Component.Contracts.ITypeTesting target = (Component.Contracts.ITypeTesting)WinRTNativeComponent.GetObjectFromNativeComponent("Component.Contracts.TypeTesting");

            // Non-WinRT managed types pass their assembly-qualified name
            Assert.AreEqual(typeof(TypeTests).AssemblyQualifiedName, target.GetTypeName(typeof(TypeTests)));

            // WinRT types pass their full name (not assembly-qualified)
            Assert.AreEqual(typeof(Component.Contracts.ITypeTesting).FullName, target.GetTypeName(typeof(Component.Contracts.ITypeTesting)));

            // Projected types pass the name of the type they are projected from
            Assert.AreEqual("Windows.UI.Xaml.Interop.TypeName", target.GetTypeName(typeof(Type)));
        }
示例#8
0
 public static void RunTest()
 {
     Component.Contracts.IKeyValuePairTesting target = (Component.Contracts.IKeyValuePairTesting)WinRTNativeComponent.GetObjectFromNativeComponent("Component.Contracts.KeyValuePairTesting");
     TestSimplePair(target);
     TestMarshaledPair(target);
 }
示例#9
0
 public static void RunTest()
 {
     Component.Contracts.IArrayTesting target = (Component.Contracts.IArrayTesting)WinRTNativeComponent.GetObjectFromNativeComponent("Component.Contracts.ArrayTesting");
     TestIntArray(target);
     TestBoolArray(target);
 }
示例#10
0
 public static void RunTest()
 {
     Component.Contracts.IEnumTesting target = (Component.Contracts.IEnumTesting)WinRTNativeComponent.GetObjectFromNativeComponent("Component.Contracts.EnumTesting");
     Assert.AreEqual(Component.Contracts.TestEnum.A, target.GetA());
     Assert.IsTrue(target.IsB(Component.Contracts.TestEnum.B));
 }