unoplatform / uno.ui.runtimetests.engine

In-App MS Tests Runner for Uno Platform and WinAppSDK
https://platform.uno/
Other
7 stars 3 forks source link

Using both [RunsOnUIThread] and [DynamicData] won't run data source on UI Thread #176

Open carldebilly opened 3 months ago

carldebilly commented 3 months ago

The dynamic data provider should run on the same context (UI Thead here) than the test itself.

[TestClass]
public class SomeTests
{
    [TestMethod]
    [RunsOnUIThread]
    [DynamicData(nameof(GetTestsData), DynamicDataSourceType.Method)]
    public Do_The_Tests(FrameworkElement element)
    {
        // Do something with the `element`
    }

    public IEnumerable<object[]> GetTestsData()
    {
        var stackPanel = new StackPanel();
        stackPanel.Children.Add(new Border()); // WILL CRASH HERE
        yield return [ stackPanel ];
    }
}