diff --git a/Directory.Build.props b/Directory.Build.props index 3425817285a..3bc21e35291 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -20,7 +20,7 @@ - true + true $(MSBuildThisFileDirectory)toolkit.snk diff --git a/GazeInputTest/App.xaml.cs b/GazeInputTest/App.xaml.cs index 8628a0a8e05..cf9e9d37340 100644 --- a/GazeInputTest/App.xaml.cs +++ b/GazeInputTest/App.xaml.cs @@ -2,8 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.Toolkit.Uwp.Input.GazeInteraction; using System; +using Microsoft.Toolkit.Uwp.Input.GazeInteraction; using Windows.ApplicationModel; using Windows.ApplicationModel.Activation; using Windows.UI.Xaml; @@ -15,9 +15,10 @@ namespace GazeInputTest /// /// Provides application-specific behavior to supplement the default Application class. /// - sealed partial class App : Application + public sealed partial class App : Application { /// + /// Initializes a new instance of the class. /// Initializes the singleton application object. This is the first line of authored code /// executed, and as such is the logical equivalent of main() or WinMain(). /// @@ -47,7 +48,7 @@ protected override void OnLaunched(LaunchActivatedEventArgs e) if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { - //TODO: Load state from previously suspended application + // TODO: Load state from previously suspended application } // Place the frame in the current Window @@ -63,6 +64,7 @@ protected override void OnLaunched(LaunchActivatedEventArgs e) // parameter rootFrame.Navigate(typeof(MainPage), e.Arguments); } + // Ensure the current window is active Window.Current.Activate(); } @@ -75,7 +77,7 @@ protected override void OnLaunched(LaunchActivatedEventArgs e) /// /// The Frame which failed navigation /// Details about the navigation failure - void OnNavigationFailed(object sender, NavigationFailedEventArgs e) + private void OnNavigationFailed(object sender, NavigationFailedEventArgs e) { throw new Exception("Failed to load Page " + e.SourcePageType.FullName); } @@ -90,7 +92,8 @@ void OnNavigationFailed(object sender, NavigationFailedEventArgs e) private void OnSuspending(object sender, SuspendingEventArgs e) { var deferral = e.SuspendingOperation.GetDeferral(); - //TODO: Save application state and stop any background activity + + // TODO: Save application state and stop any background activity deferral.Complete(); } } diff --git a/GazeInputTest/GazeInputTest.csproj b/GazeInputTest/GazeInputTest.csproj index a5a648e7b9b..be4c11e437e 100644 --- a/GazeInputTest/GazeInputTest.csproj +++ b/GazeInputTest/GazeInputTest.csproj @@ -152,6 +152,9 @@ 6.2.9 + + 1.0.2 + diff --git a/GazeInputTest/MainPage.xaml.cs b/GazeInputTest/MainPage.xaml.cs index 3bb6d9cdf15..9ccdea4eaf2 100644 --- a/GazeInputTest/MainPage.xaml.cs +++ b/GazeInputTest/MainPage.xaml.cs @@ -2,8 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Microsoft.Toolkit.Uwp.Input.GazeInteraction; using System; +using Microsoft.Toolkit.Uwp.Input.GazeInteraction; using Windows.ApplicationModel.Core; using Windows.UI.Core; using Windows.UI.ViewManagement; @@ -50,18 +50,18 @@ private void ShowCursor_Toggle(object sender, RoutedEventArgs e) } } - int clickCount; + private int _clickCount; private void OnLegacyInvoked(object sender, RoutedEventArgs e) { - clickCount++; - HowButton.Content = string.Format("{0}: Legacy click", clickCount); + _clickCount++; + HowButton.Content = string.Format("{0}: Legacy click", _clickCount); } private void OnGazeInvoked(object sender, DwellInvokedRoutedEventArgs e) { - clickCount++; - HowButton.Content = string.Format("{0}: Accessible click", clickCount); + _clickCount++; + HowButton.Content = string.Format("{0}: Accessible click", _clickCount); e.Handled = true; } @@ -71,13 +71,13 @@ private void OnInvokeProgress(object sender, DwellProgressEventArgs e) { ProgressShow.Value = 100.0 * e.Progress; } + ProgressShow.IsIndeterminate = e.State == DwellProgressState.Complete; e.Handled = true; } private async void SpawnClicked(object sender, RoutedEventArgs e) { - var newView = CoreApplication.CreateNewView(); var newViewId = 0; diff --git a/UnitTests/Helpers/TestCollectionCapableDeepLinkParser.cs b/UnitTests/Helpers/TestCollectionCapableDeepLinkParser.cs new file mode 100644 index 00000000000..1e71e890093 --- /dev/null +++ b/UnitTests/Helpers/TestCollectionCapableDeepLinkParser.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using Microsoft.Toolkit.Uwp.Helpers; + +namespace UnitTests +{ + internal class TestCollectionCapableDeepLinkParser : CollectionFormingDeepLinkParser + { + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors", Justification = "Call stack reviewed.")] + public TestCollectionCapableDeepLinkParser(string uri) + : base(uri) + { + } + + public TestCollectionCapableDeepLinkParser(Uri uri) + : base(uri) + { + } + } +} diff --git a/UnitTests/Helpers/TestDeepLinkParser.cs b/UnitTests/Helpers/TestDeepLinkParser.cs index 5a0efb967b9..d7dea2df295 100644 --- a/UnitTests/Helpers/TestDeepLinkParser.cs +++ b/UnitTests/Helpers/TestDeepLinkParser.cs @@ -2,11 +2,11 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System; +using Microsoft.Toolkit.Uwp.Helpers; + namespace UnitTests { - using System; - using Microsoft.Toolkit.Uwp.Helpers; - internal class TestDeepLinkParser : DeepLinkParser { [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors", Justification = "Call stack reviewed.")] @@ -20,18 +20,4 @@ public TestDeepLinkParser(Uri uri) { } } - - internal class TestCollectionCapableDeepLinkParser : CollectionFormingDeepLinkParser - { - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors", Justification = "Call stack reviewed.")] - public TestCollectionCapableDeepLinkParser(string uri) - : base(uri) - { - } - - public TestCollectionCapableDeepLinkParser(Uri uri) - : base(uri) - { - } - } } diff --git a/UnitTests/Properties/UnitTestApp.rd.xml b/UnitTests/Properties/UnitTestApp.rd.xml index efee59d2788..6e2afca77fe 100644 --- a/UnitTests/Properties/UnitTestApp.rd.xml +++ b/UnitTests/Properties/UnitTestApp.rd.xml @@ -24,6 +24,7 @@ + \ No newline at end of file diff --git a/UnitTests/UnitTests.Notifications.NetCore/UnitTests.Notifications.NetCore.csproj b/UnitTests/UnitTests.Notifications.NetCore/UnitTests.Notifications.NetCore.csproj index 805a39d0db4..47091ffe5a6 100644 --- a/UnitTests/UnitTests.Notifications.NetCore/UnitTests.Notifications.NetCore.csproj +++ b/UnitTests/UnitTests.Notifications.NetCore/UnitTests.Notifications.NetCore.csproj @@ -5,12 +5,14 @@ false + ;CS8002 + - - - + + + diff --git a/UnitTests/UnitTests.Notifications.UWP/UnitTests.Notifications.UWP.csproj b/UnitTests/UnitTests.Notifications.UWP/UnitTests.Notifications.UWP.csproj index 22884f98e50..33a31093954 100644 --- a/UnitTests/UnitTests.Notifications.UWP/UnitTests.Notifications.UWP.csproj +++ b/UnitTests/UnitTests.Notifications.UWP/UnitTests.Notifications.UWP.csproj @@ -19,6 +19,8 @@ $(VisualStudioVersion) false + + true bin\x86\Debug\ @@ -34,7 +36,7 @@ bin\x86\Release\ TRACE;NETFX_CORE;WINDOWS_UWP true - ;2008 + ;2008;CS8002 pdbonly x86 false @@ -58,7 +60,7 @@ bin\ARM\Release\ TRACE;NETFX_CORE;WINDOWS_UWP true - ;2008 + ;2008;CS8002 pdbonly ARM false @@ -82,7 +84,7 @@ bin\x64\Release\ TRACE;NETFX_CORE;WINDOWS_UWP true - ;2008 + ;2008;CS8002 pdbonly x64 false @@ -109,7 +111,7 @@ bin\ARM64\Release\ TRACE;NETFX_CORE;WINDOWS_UWP true - ;2008 + ;2008;CS8002 pdbonly ARM64 false diff --git a/UnitTests/UnitTests.Notifications.WinRT/UnitTests.Notifications.WinRT.csproj b/UnitTests/UnitTests.Notifications.WinRT/UnitTests.Notifications.WinRT.csproj index 76e0af7e3ab..cf46a3dfb57 100644 --- a/UnitTests/UnitTests.Notifications.WinRT/UnitTests.Notifications.WinRT.csproj +++ b/UnitTests/UnitTests.Notifications.WinRT/UnitTests.Notifications.WinRT.csproj @@ -19,6 +19,8 @@ $(VisualStudioVersion) false + + true bin\x86\Debug\ @@ -34,7 +36,7 @@ bin\x86\Release\ TRACE;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS;WINRT true - ;2008 + ;2008;CS8002 pdbonly x86 false @@ -58,7 +60,7 @@ bin\ARM\Release\ TRACE;NETFX_CORE;WINDOWS_UWP;WINRT true - ;2008 + ;2008;CS8002 pdbonly ARM false @@ -82,7 +84,7 @@ bin\x64\Release\ TRACE;NETFX_CORE;WINDOWS_UWP;WINRT true - ;2008 + ;2008;CS8002 pdbonly x64 false @@ -109,7 +111,7 @@ bin\ARM64\Release\ TRACE;NETFX_CORE;WINDOWS_UWP;WINRT true - ;2008 + ;2008;CS8002 pdbonly ARM64 false @@ -125,10 +127,10 @@ 6.2.9 - 1.2.0 + 2.1.0 - 1.2.0 + 2.1.0 4.3.0 diff --git a/UnitTests/UnitTests.csproj b/UnitTests/UnitTests.csproj index 2766897eb21..45aec0e7e7c 100644 --- a/UnitTests/UnitTests.csproj +++ b/UnitTests/UnitTests.csproj @@ -19,6 +19,8 @@ $(VisualStudioVersion) false + + true bin\x86\Debug\ @@ -105,10 +107,13 @@ 6.2.9 - 1.2.0 + 2.1.0 - 1.2.0 + 2.1.0 + + + 4.3.0 4.3.0 @@ -129,6 +134,7 @@ + diff --git a/Windows Community Toolkit.sln b/Windows Community Toolkit.sln index 46e27005eba..2a562708db3 100644 --- a/Windows Community Toolkit.sln +++ b/Windows Community Toolkit.sln @@ -192,6 +192,7 @@ Global {A139968E-AD78-4E8C-93B8-9A5523BCAC89}.Native|x64.ActiveCfg = Release|x64 {A139968E-AD78-4E8C-93B8-9A5523BCAC89}.Native|x86.ActiveCfg = Release|x86 {A139968E-AD78-4E8C-93B8-9A5523BCAC89}.Release|Any CPU.ActiveCfg = Release|x86 + {A139968E-AD78-4E8C-93B8-9A5523BCAC89}.Release|Any CPU.Build.0 = Release|x86 {A139968E-AD78-4E8C-93B8-9A5523BCAC89}.Release|ARM.ActiveCfg = Release|ARM {A139968E-AD78-4E8C-93B8-9A5523BCAC89}.Release|ARM.Build.0 = Release|ARM {A139968E-AD78-4E8C-93B8-9A5523BCAC89}.Release|ARM.Deploy.0 = Release|ARM @@ -349,6 +350,7 @@ Global {BAB1CAF4-C400-4A7F-A987-C576DE63CFFD}.Native|x64.ActiveCfg = Release|x64 {BAB1CAF4-C400-4A7F-A987-C576DE63CFFD}.Native|x86.ActiveCfg = Release|x86 {BAB1CAF4-C400-4A7F-A987-C576DE63CFFD}.Release|Any CPU.ActiveCfg = Release|x86 + {BAB1CAF4-C400-4A7F-A987-C576DE63CFFD}.Release|Any CPU.Build.0 = Release|x86 {BAB1CAF4-C400-4A7F-A987-C576DE63CFFD}.Release|ARM.ActiveCfg = Release|ARM {BAB1CAF4-C400-4A7F-A987-C576DE63CFFD}.Release|ARM.Build.0 = Release|ARM {BAB1CAF4-C400-4A7F-A987-C576DE63CFFD}.Release|ARM.Deploy.0 = Release|ARM @@ -526,6 +528,7 @@ Global {94994424-5F60-4CD8-ABA2-101779066208}.Native|x64.ActiveCfg = Release|Any CPU {94994424-5F60-4CD8-ABA2-101779066208}.Native|x86.ActiveCfg = Release|Any CPU {94994424-5F60-4CD8-ABA2-101779066208}.Release|Any CPU.ActiveCfg = Release|Any CPU + {94994424-5F60-4CD8-ABA2-101779066208}.Release|Any CPU.Build.0 = Release|Any CPU {94994424-5F60-4CD8-ABA2-101779066208}.Release|ARM.ActiveCfg = Release|Any CPU {94994424-5F60-4CD8-ABA2-101779066208}.Release|ARM.Build.0 = Release|Any CPU {94994424-5F60-4CD8-ABA2-101779066208}.Release|ARM64.ActiveCfg = Release|Any CPU @@ -554,6 +557,7 @@ Global {EFA96B3C-857E-4659-B942-6BEF7719F4CA}.Native|x64.ActiveCfg = Release|x64 {EFA96B3C-857E-4659-B942-6BEF7719F4CA}.Native|x86.ActiveCfg = Release|x86 {EFA96B3C-857E-4659-B942-6BEF7719F4CA}.Release|Any CPU.ActiveCfg = Release|x86 + {EFA96B3C-857E-4659-B942-6BEF7719F4CA}.Release|Any CPU.Build.0 = Release|x86 {EFA96B3C-857E-4659-B942-6BEF7719F4CA}.Release|ARM.ActiveCfg = Release|ARM {EFA96B3C-857E-4659-B942-6BEF7719F4CA}.Release|ARM.Build.0 = Release|ARM {EFA96B3C-857E-4659-B942-6BEF7719F4CA}.Release|ARM.Deploy.0 = Release|ARM @@ -790,7 +794,6 @@ Global {75F9EE44-3EFA-47BC-AEDD-351B9834A0AF}.Native|x64.ActiveCfg = Debug|Any CPU {75F9EE44-3EFA-47BC-AEDD-351B9834A0AF}.Native|x64.Build.0 = Debug|Any CPU {75F9EE44-3EFA-47BC-AEDD-351B9834A0AF}.Native|x86.ActiveCfg = Debug|Any CPU - {75F9EE44-3EFA-47BC-AEDD-351B9834A0AF}.Native|x86.Build.0 = Debug|Any CPU {75F9EE44-3EFA-47BC-AEDD-351B9834A0AF}.Release|Any CPU.ActiveCfg = Release|Any CPU {75F9EE44-3EFA-47BC-AEDD-351B9834A0AF}.Release|Any CPU.Build.0 = Release|Any CPU {75F9EE44-3EFA-47BC-AEDD-351B9834A0AF}.Release|ARM.ActiveCfg = Release|Any CPU diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0c8e1ef2d5e..55ea084ff2a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -44,9 +44,16 @@ steps: #- powershell: .\build\Install-WindowsSdkISO.ps1 17763 # displayName: Insider SDK -- powershell: .\build\build.ps1 -target=Package +- powershell: .\build\build.ps1 -target=Default displayName: Build +- task: PublishTestResults@2 + inputs: + testResultsFormat: 'VSTest' + testResultsFiles: '**/VsTestResults.xml' + displayName: Publish Test Results + condition: succeededOrFailed() + - task: PowerShell@2 displayName: Authenticode Sign Packages inputs: diff --git a/build/build.cake b/build/build.cake index 2c466a9db82..8ed18baec52 100644 --- a/build/build.cake +++ b/build/build.cake @@ -3,6 +3,9 @@ #addin nuget:?package=Cake.FileHelpers&version=3.2.1 #addin nuget:?package=Cake.Powershell&version=0.4.8 +#tool nuget:?package=MSTest.TestAdapter&version=2.1.0 +#tool nuget:?package=vswhere&version=2.8.4 + using System; using System.Linq; using System.Text.RegularExpressions; @@ -246,6 +249,39 @@ Task("Package") } }); +public string getMSTestAdapterPath(){ + var nugetPaths = GetDirectories("./tools/MSTest.TestAdapter*/build/_common"); + + if(nugetPaths.Count == 0){ + throw new Exception( + "Cannot locate the MSTest test adapter. " + + "You might need to add '#tool nuget:?package=MSTest.TestAdapter&version=2.1.0' " + + "to the top of your build.cake file."); + } + + return nugetPaths.Last().ToString(); +} + +Task("Test") + .Description("Runs all Tests") + .IsDependentOn("Build") + .Does(() => +{ + var vswhere = VSWhereLatest(new VSWhereLatestSettings + { + IncludePrerelease = false + }); + + var testSettings = new VSTestSettings + { + ToolPath = vswhere + "/Common7/IDE/CommonExtensions/Microsoft/TestWindow/vstest.console.exe", + TestAdapterPath = getMSTestAdapterPath(), + ArgumentCustomization = arg => arg.Append("/logger:trx;LogFileName=VsTestResults.xml /framework:FrameworkUap10"), + }; + + VSTest(baseDir + "/**/UnitTests.*.appxrecipe", testSettings); +}); + ////////////////////////////////////////////////////////////////////// @@ -253,6 +289,7 @@ Task("Package") ////////////////////////////////////////////////////////////////////// Task("Default") + .IsDependentOn("Test") .IsDependentOn("Package"); Task("UpdateHeaders") diff --git a/build/tools/packages.config b/build/tools/packages.config index ec87d006ab6..cedcc6ab51f 100644 --- a/build/tools/packages.config +++ b/build/tools/packages.config @@ -1,4 +1,4 @@ - +