Exemplo n.º 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);
            }
        }
Exemplo n.º 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));
        }
Exemplo n.º 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));
 }
Exemplo n.º 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()));
        }
Exemplo n.º 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));
 }
Exemplo n.º 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));
        }
Exemplo n.º 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)));
        }
Exemplo n.º 8
0
 public static void RunTest()
 {
     Component.Contracts.IKeyValuePairTesting target = (Component.Contracts.IKeyValuePairTesting)WinRTNativeComponent.GetObjectFromNativeComponent("Component.Contracts.KeyValuePairTesting");
     TestSimplePair(target);
     TestMarshaledPair(target);
 }
Exemplo n.º 9
0
 public static void RunTest()
 {
     Component.Contracts.IArrayTesting target = (Component.Contracts.IArrayTesting)WinRTNativeComponent.GetObjectFromNativeComponent("Component.Contracts.ArrayTesting");
     TestIntArray(target);
     TestBoolArray(target);
 }
Exemplo n.º 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));
 }