From 3a7b92ef8a0a2812aab9d0e499ef9492635b4747 Mon Sep 17 00:00:00 2001 From: Codrin-Victor Poienaru Date: Thu, 7 Apr 2022 16:50:00 +0200 Subject: [PATCH] Cherry-picked: [UITestMethod] should invoke test method with null (#1045) (#1061) Co-authored-by: Nandin Borjigin --- src/TestFramework/Extension.UWP/UITestMethodAttribute.cs | 2 +- src/TestFramework/Extension.WinUI/UITestMethodAttribute.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/TestFramework/Extension.UWP/UITestMethodAttribute.cs b/src/TestFramework/Extension.UWP/UITestMethodAttribute.cs index 6382aee862..33d6bae6ef 100644 --- a/src/TestFramework/Extension.UWP/UITestMethodAttribute.cs +++ b/src/TestFramework/Extension.UWP/UITestMethodAttribute.cs @@ -35,7 +35,7 @@ public override TestResult[] Execute(ITestMethod testMethod) Windows.UI.Core.CoreDispatcherPriority.Normal, () => { - result = testMethod.Invoke(new object[] { }); + result = testMethod.Invoke(null); }).AsTask().GetAwaiter().GetResult(); return new TestResult[] { result }; diff --git a/src/TestFramework/Extension.WinUI/UITestMethodAttribute.cs b/src/TestFramework/Extension.WinUI/UITestMethodAttribute.cs index 839a9d84eb..4b840591a3 100644 --- a/src/TestFramework/Extension.WinUI/UITestMethodAttribute.cs +++ b/src/TestFramework/Extension.WinUI/UITestMethodAttribute.cs @@ -48,7 +48,7 @@ public override TestResult[] Execute(ITestMethod testMethod) { try { - result = testMethod.Invoke(Array.Empty()); + result = testMethod.Invoke(null); } catch (Exception e) {