Make sure that if a verification fails, we fail the test. (#107)

* Make sure that if a verification fails, we fail the test. MSTEST seems to pass the test if the verify falis in the UIThread. Also fixed the tests that were failing with that fix.
This commit is contained in:
Ranjesh 2018-12-18 15:40:29 -08:00 коммит произвёл GitHub
Родитель 3cb3c0fde2
Коммит 26687a2fcf
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 118 добавлений и 19 удалений

4
.gitignore поставляемый
Просмотреть файл

@ -261,4 +261,6 @@ dev/dll/XamlTypeInfo.g.*
manifest/Microsoft-Windows-UI-Xaml-MUXControls.man
artifacts/
HelixPayload/
HelixPayload/
/test/MUXControlsTestApp/MSTest/MUXControlsTestApp_Test
/test/MUXControlsTestApp/TAEF/MUXControlsTestApp_Test

Просмотреть файл

@ -674,6 +674,41 @@ Global
dev\ColorPicker\InteractionTests\ColorPicker_InteractionTests.projitems*{a4d2fae8-e7fc-4100-91ff-2202fac91c70}*SharedItemsImports = 13
dev\CommonStyles\TestUI\CommonStyles_TestUI.projitems*{a7f6d6c4-a5a9-43eb-930c-b766417a5e5c}*SharedItemsImports = 13
dev\Materials\Acrylic\TestUI\AcrylicBrush_TestUI.projitems*{a800e818-7212-4fd7-ae3a-1dcab539db87}*SharedItemsImports = 13
dev\Collections\Collections.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\ColorPicker\ColorPicker.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\CommandBarFlyout\CommandBarFlyout.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\CommonStyles\CommonStyles.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\Common\Common.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\DropDownButton\DropDownButton.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\Effects\Microsoft.UI.Composition.Effects.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\IconSource\IconSource.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\LayoutPanel\LayoutPanel.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\Lights\Lights.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\Materials\Acrylic\AcrylicBrush.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\Materials\Reveal\RevealBrush.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\MenuBar\MenuBar.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\MenuFlyout\MenuFlyout.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\NavigationView\NavigationView.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\ParallaxView\ParallaxView.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\PersonPicture\PersonPicture.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\PullToRefresh\PTRTracing\PTRTracing.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\PullToRefresh\RefreshContainer\RefreshContainer.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\PullToRefresh\RefreshVisualizer\RefreshVisualizer.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\PullToRefresh\ScrollViewerIRefreshInfoProviderAdapter\ScrollViewerIRefreshInfoProviderAdapter.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\RadioButtons\RadioButtons.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\RadioMenuFlyoutItem\RadioMenuFlyoutItem.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\RatingControl\RatingControl.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\Repeater\Repeater.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\ResourceHelper\ResourceHelper.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\ScrollBar2\ScrollBar2.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\ScrollerView\ScrollerView.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\Scroller\Scroller.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\SplitButton\SplitButton.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\SwipeControl\SwipeControl.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\Telemetry\Telemetry.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\TestHooks\TestHooks.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\TreeView\TreeView.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\TwoPaneView\TwoPaneView.vcxitems*{ad0c90b0-4845-4d4b-88f1-86f653f8171b}*SharedItemsImports = 4
dev\TreeView\InteractionTests\TreeView_InteractionTests.projitems*{ae638a24-2bc6-4d4f-a51e-715d198f01fd}*SharedItemsImports = 13
dev\RatingControl\InteractionTests\RatingControl_InteractionTests.projitems*{afaad014-132c-4d2a-a28e-4ef717d3e647}*SharedItemsImports = 13
dev\ScrollBar2\TestUI\ScrollBar2_TestUI.projitems*{b01524d9-32fa-58bc-84a9-49ac965a31ad}*SharedItemsImports = 13
@ -708,6 +743,55 @@ Global
dev\Materials\Acrylic\InteractionTests\AcrylicBrush_InteractionTests.projitems*{f601284a-00c1-49f9-99b3-70d45585f784}*SharedItemsImports = 13
dev\SplitButton\SplitButton.vcxitems*{faf114dd-af1f-4d9f-a511-354c19912aad}*SharedItemsImports = 9
test\TestAppUtils\TestAppUtils.projitems*{fb0d3053-3135-403f-b542-977f3b781673}*SharedItemsImports = 13
dev\ColorPicker\APITests\ColorPicker_APITests.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\ColorPicker\TestUI\ColorPicker_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\CommandBarFlyout\APITests\CommandBarFlyout_APITests.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\CommandBarFlyout\TestUI\CommandBarFlyout_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\CommonManaged\CommonManaged.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\CommonStyles\TestUI\CommonStyles_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\DropDownButton\TestUI\DropDownButton_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\IconSource\APITests\IconSource_APITests.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\LayoutPanel\APITests\LayoutPanel_APITests.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\lights\ApiTests\Lights_ApiTests\Lights_ApiTests.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\Materials\Acrylic\APITests\AcrylicBrush_ApiTests.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\Materials\Acrylic\TestUI\AcrylicBrush_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\Materials\Reveal\APITests\Reveal_APITests.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\Materials\Reveal\TestUI\Reveal_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\MenuBar\MenuBar_TestUI\MenuBar_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\MenuFlyout\TestUI\MenuFlyout_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\NavigationView\NavigationView_ApiTests\NavigationView_ApiTests.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\NavigationView\TestUI\NavigationView_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\ParallaxView\APITests\ParallaxView_APITests.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\ParallaxView\TestUI\ParallaxView_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\PersonPicture\APITests\PersonPicture_APITests.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\PersonPicture\TestUI\PersonPicture_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\PullToRefresh\RefreshContainer\TestUI\RefreshContainer_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\PullToRefresh\RefreshVisualizer\APITests\RefreshVisualizer_APITests.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\PullToRefresh\RefreshVisualizer\TestUI\RefreshVisualizer_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\PullToRefresh\ScrollViewerIRefreshInfoProviderAdapter\APITests\APITests.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\PullToRefresh\ScrollViewerIRefreshInfoProviderAdapter\TestUI\ScrollViewerAdapter_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\PullToRefresh\TestUI\PTR_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\RadioButtons\TestUI\RadioButtons_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\RadioMenuFlyoutItem\TestUI\RadioMenuFlyoutItem_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\RatingControl\APITests\RatingControl_APITests.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\RatingControl\TestUI\RatingControl_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\Repeater\APITests\Repeater_APITests.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\Repeater\TestUI\Repeater_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\ScrollBar2\APITests\ScrollBar2_APITests.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\ScrollBar2\TestUI\ScrollBar2_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\ScrollerView\APITests\ScrollerView_APITests.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\ScrollerView\TestUI\ScrollerView_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\Scroller\APITests\Scroller_APITests.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\Scroller\TestUI\Scroller_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\SplitButton\APITests\SplitButton_APITests.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\SplitButton\TestUI\SplitButton_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\SwipeControl\SwipeControl_APITests\SwipeControl_APITests.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\SwipeControl\SwipeControl_TestUI\SwipeControl_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\TreeView\APITests\TreeView_APITests.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\TreeView\TestUI\TreeView_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\TwoPaneView\APITests\TwoPaneView_APITests.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\TwoPaneView\TestUI\TwoPaneView_TestUI.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
test\TestAppUtils\TestAppUtils.projitems*{fbc396f5-26dd-4ca3-981e-c7bc9fea4546}*SharedItemsImports = 4
dev\LayoutPanel\LayoutPanel.vcxitems*{fd3c1a00-0d07-4849-a3b9-646f0ff21d7b}*SharedItemsImports = 9
dev\SwipeControl\SwipeControl.vcxitems*{fd63f767-bd98-45d9-8a63-3cd4a148d527}*SharedItemsImports = 9
EndGlobalSection

Просмотреть файл

@ -141,10 +141,15 @@ namespace Common
Assert.Fail(message, args);
}
public static void Throws<T>(Action action, string message = null) where T : Exception
public static void Throws<T>(Action action, string message) where T : Exception
{
Assert.ThrowsException<T>(action, message);
}
public static void Throws<T>(Action action) where T : Exception
{
Assert.ThrowsException<T>(action);
}
}
}
#endif

Просмотреть файл

@ -45,7 +45,7 @@ namespace Windows.UI.Xaml.Tests.MUXControls.ApiTests
{
ScrollViewerIRefreshInfoProviderAdapter adapter = new ScrollViewerIRefreshInfoProviderAdapter(RefreshPullDirection.TopToBottom, null);
Verify.IsNotNull(adapter);
Verify.Throws<Exception>(() => { adapter.Adapt(null, new Size(1.0, 1.0)); });
Verify.Throws<ArgumentException>(() => { adapter.Adapt(null, new Size(1.0, 1.0)); });
});
}
@ -66,7 +66,7 @@ namespace Windows.UI.Xaml.Tests.MUXControls.ApiTests
ScrollViewer sv = (ScrollViewer)MUXControlsTestApp.App.TestContentRoot;
ScrollViewerIRefreshInfoProviderAdapter adapter = new ScrollViewerIRefreshInfoProviderAdapter(RefreshPullDirection.TopToBottom, null);
Verify.IsNotNull(adapter);
Verify.Throws<Exception>(() => { adapter.Adapt(sv, new Size(1.0, 1.0)); });
Verify.Throws<ArgumentException>(() => { adapter.Adapt(sv, new Size(1.0, 1.0)); });
});
}
@ -90,7 +90,7 @@ namespace Windows.UI.Xaml.Tests.MUXControls.ApiTests
Verify.IsNull(sv.Content);
ScrollViewerIRefreshInfoProviderAdapter adapter = new ScrollViewerIRefreshInfoProviderAdapter(RefreshPullDirection.TopToBottom, null);
Verify.IsNotNull(adapter);
Verify.Throws<Exception>(() => { adapter.Adapt(sv, new Size(1.0, 1.0)); });
Verify.Throws<ArgumentException>(() => { adapter.Adapt(sv, new Size(1.0, 1.0)); });
});
}

Просмотреть файл

@ -3,6 +3,7 @@
using MUXControlsTestApp.Utilities;
using System;
using System.Runtime.InteropServices;
using Windows.UI.Xaml.Controls;
using Common;
@ -31,16 +32,16 @@ namespace Windows.UI.Xaml.Tests.MUXControls.ApiTests
[TestProperty("Description", "Create a bunch of snap points with invalid arguments.")]
public void SnapPointsWithInvalidArgsThrow()
{
Verify.Throws<Exception>(() => { new ScrollerSnapPointRegular(offset: 10, interval: 0, start: 10, end: 100, alignment: ScrollerSnapPointAlignment.Near); });
Verify.Throws<Exception>(() => { new ScrollerSnapPointRegular(offset: 10, interval: -1, start: 10, end: 100, alignment: ScrollerSnapPointAlignment.Near); });
Verify.Throws<Exception>(() => { new ScrollerSnapPointRegular(offset: 10, interval: 10, start: 10, end: 1, alignment: ScrollerSnapPointAlignment.Near); });
Verify.Throws<Exception>(() => { new ScrollerSnapPointRegular(offset: 10, interval: 10, start: 10, end: 10, alignment: ScrollerSnapPointAlignment.Near); });
Verify.Throws<Exception>(() => { new ScrollerSnapPointRegular(offset: 1, interval: 10, start: 1, end: 10, applicableRange: -10, alignment: ScrollerSnapPointAlignment.Near); });
Verify.Throws<Exception>(() => { new ScrollerSnapPointRegular(offset: 1, interval: 10, start: 1, end: 10, applicableRange: 0, alignment: ScrollerSnapPointAlignment.Near); });
Verify.Throws<Exception>(() => { new ScrollerSnapPointRegular(offset: 50, interval: 10, start: 100, end: 200, applicableRange: 2, alignment: ScrollerSnapPointAlignment.Near); });
Verify.Throws<Exception>(() => { new ScrollerSnapPointRegular(offset: 250, interval: 10, start: 100, end: 200, applicableRange: 2, alignment: ScrollerSnapPointAlignment.Near); });
Verify.Throws<Exception>(() => { new ScrollerSnapPointIrregular(snapPointValue: 0, applicableRange: 0, alignment: ScrollerSnapPointAlignment.Near); });
Verify.Throws<Exception>(() => { new ScrollerSnapPointIrregular(snapPointValue: 0, applicableRange: -1, alignment: ScrollerSnapPointAlignment.Near); });
Verify.Throws<COMException>(() => { new ScrollerSnapPointRegular(offset: 10, interval: 0, start: 10, end: 100, alignment: ScrollerSnapPointAlignment.Near); });
Verify.Throws<COMException>(() => { new ScrollerSnapPointRegular(offset: 10, interval: -1, start: 10, end: 100, alignment: ScrollerSnapPointAlignment.Near); });
Verify.Throws<COMException>(() => { new ScrollerSnapPointRegular(offset: 10, interval: 10, start: 10, end: 1, alignment: ScrollerSnapPointAlignment.Near); });
Verify.Throws<COMException>(() => { new ScrollerSnapPointRegular(offset: 10, interval: 10, start: 10, end: 10, alignment: ScrollerSnapPointAlignment.Near); });
Verify.Throws<COMException>(() => { new ScrollerSnapPointRegular(offset: 1, interval: 10, start: 1, end: 10, applicableRange: -10, alignment: ScrollerSnapPointAlignment.Near); });
Verify.Throws<COMException>(() => { new ScrollerSnapPointRegular(offset: 1, interval: 10, start: 1, end: 10, applicableRange: 0, alignment: ScrollerSnapPointAlignment.Near); });
Verify.Throws<COMException>(() => { new ScrollerSnapPointRegular(offset: 50, interval: 10, start: 100, end: 200, applicableRange: 2, alignment: ScrollerSnapPointAlignment.Near); });
Verify.Throws<COMException>(() => { new ScrollerSnapPointRegular(offset: 250, interval: 10, start: 100, end: 200, applicableRange: 2, alignment: ScrollerSnapPointAlignment.Near); });
Verify.Throws<COMException>(() => { new ScrollerSnapPointIrregular(snapPointValue: 0, applicableRange: 0, alignment: ScrollerSnapPointAlignment.Near); });
Verify.Throws<COMException>(() => { new ScrollerSnapPointIrregular(snapPointValue: 0, applicableRange: -1, alignment: ScrollerSnapPointAlignment.Near); });
}
[TestMethod]
@ -57,8 +58,8 @@ namespace Windows.UI.Xaml.Tests.MUXControls.ApiTests
ScrollerSnapPointRegular snapPoint5 = new ScrollerSnapPointRegular(offset: 100, interval: 2, start: 100, end: 200, alignment: ScrollerSnapPointAlignment.Near);
scroller.VerticalSnapPoints.Add(snapPoint1);
Verify.Throws<Exception>(() => { scroller.VerticalSnapPoints.Add(snapPoint2); });
Verify.Throws<Exception>(() => { scroller.VerticalSnapPoints.Add(snapPoint3); });
Verify.Throws<ArgumentException>(() => { scroller.VerticalSnapPoints.Add(snapPoint2); });
Verify.Throws<ArgumentException>(() => { scroller.VerticalSnapPoints.Add(snapPoint3); });
scroller.HorizontalSnapPoints.Add(snapPoint4);
scroller.HorizontalSnapPoints.Add(snapPoint5);
});

Просмотреть файл

@ -30,6 +30,7 @@ namespace MUXControlsTestApp.Utilities
public static void Execute(CoreApplicationView whichView, Action action)
{
Exception exception = null;
var dispatcher = whichView.Dispatcher;
if (dispatcher.HasThreadAccess)
{
@ -51,7 +52,8 @@ namespace MUXControlsTestApp.Utilities
}
catch (Exception e)
{
Verify.Fail("Exception thrown by action on the UI thread: " + e.ToString());
exception = e;
throw;
}
finally // Unblock calling thread even if action() throws
{
@ -69,7 +71,8 @@ namespace MUXControlsTestApp.Utilities
}
catch (Exception e)
{
Verify.Fail("Exception thrown by action on the UI thread: " + e.ToString());
exception = e;
throw;
}
finally // Unblock calling thread even if action() throws
{
@ -80,6 +83,10 @@ namespace MUXControlsTestApp.Utilities
});
workComplete.WaitOne();
if (exception != null)
{
Verify.Fail("Exception thrown by action on the UI thread: " + exception.ToString());
}
}
}