XUnits アプリを使用して試すことができます:
https://channel9.msdn.com/Shows/demooftheday/xunit-in-uwp
これにより、テストは VS Test Explorer ではなく、XUnit のテスト アプリで実行されます。
私のユニットテストプロジェクトの project.json で
{
"dependencies": {
"Microsoft.NETCore.UniversalWindowsPlatform": "5.1.0",
"xunit": "2.1.0",
"xunit.runner.devices": "2.1.0" }, "frameworks": {
"uap10.0": { } }, "runtimes": {
"win10-arm": { },
"win10-arm-aot": { },
"win10-x86": { },
"win10-x86-aot": { },
"win10-x64": { },
"win10-x64-aot": { } }
}
次に、UnitTestapp.xaml という名前の単体テスト プロジェクトの XAML ファイルに移動し、次のように変更します。
<ui:RunnerApplication
x:Class="UnitTestProject1.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:UnitTestProject1"
xmlns:ui="using:Xunit.Runners.UI"
RequestedTheme="Light">
</ui:RunnerApplication>
そしてもちろん、コードビハインドでは:
sealed partial class App : RunnerApplication
{
protected override void OnInitializeRunner()
{
AddTestAssembly(GetType().GetTypeInfo().Assembly);
InitializeRunner();
}
partial void InitializeRunner();
}