Skip to content

Commit 794b295

Browse files
author
msftbot[bot]
authored
Add WinUI 2.6 Dependency to UnitTests.UWP App (#4156)
## Related to #3650 Splitting out the upgrade to WinUI 2.6 in the Unit Tests project to help try and isolate what might be going on. Noticed some our other NuGet dependencies have updates as well, so if this works as-is, will try and update those as well. Then we can check this in, and rebase #3650 to try and determine what else might be going on or pull in others to help investigate. FYI @huynhsontung @azchohfi ## PR Type What kind of change does this PR introduce? <!-- Please uncomment one or more options below that apply to this PR. --> <!-- - Bugfix --> <!-- - Feature --> <!-- - Code style update (formatting) --> - Refactoring (no functional changes, no api changes) <!-- - Build or CI related changes --> <!-- - Documentation content changes --> <!-- - Sample app changes --> <!-- - Other... Please describe: --> ## What is the current behavior? WinUI 2.6 not included when we run unit tests ## What is the new behavior? WinUI 2.6 is now included when we run unit tests. ## PR Checklist Please check if your PR fulfills the following requirements: - [ ] Tested code with current [supported SDKs](../readme.md#supported) - [ ] Pull Request has been submitted to the documentation repository [instructions](..\contributing.md#docs). Link: <!-- docs PR link --> - [ ] Sample in sample app has been added / updated (for bug fixes / features) - [ ] Icon has been created (if new sample) following the [Thumbnail Style Guide and templates](https://github.com/CommunityToolkit/WindowsCommunityToolkit-design-assets) - [ ] New major technical changes in the toolkit have or will be added to the [Wiki](https://github.com/CommunityToolkit/WindowsCommunityToolkit/wiki) e.g. build changes, source generators, testing infrastructure, sample creation changes, etc... - [ ] Tests for the changes have been added (for bug fixes / features) (if applicable) - [ ] Header has been added to all new source files (run *build/UpdateHeaders.bat*) - [ ] Contains **NO** breaking changes <!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. Please note that breaking changes are likely to be rejected within minor release cycles or held until major versions. --> ## Other information
2 parents 16d2886 + db71796 commit 794b295

File tree

12 files changed

+94
-72
lines changed

12 files changed

+94
-72
lines changed

UITests/UITests.Tests.MSTest/UITests.Tests.MSTest.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<!-- MSTest -->
1616
<PackageReference Include="MSTest.TestAdapter" Version="2.1.2" />
1717
<PackageReference Include="MSTest.TestFramework" Version="2.1.2" />
18-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
18+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
1919
<!-- Microsoft.UI.Xaml MSTest Extension -->
2020
<PackageReference Include="MUXTestInfra.MSTest" Version="0.0.4" />
2121
<!-- System packages -->

UnitTests/UnitTests.HighPerformance.NetCore/UnitTests.HighPerformance.NetCore.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<ItemGroup>
1313
<PackageReference Include="MSTest.TestAdapter" Version="2.1.2" />
1414
<PackageReference Include="MSTest.TestFramework" Version="2.1.2" />
15-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
15+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
1616
</ItemGroup>
1717

1818
<!-- .NET Core 2.1 doesn't have the Unsafe type -->

UnitTests/UnitTests.HighPerformance.UWP/UnitTests.HighPerformance.UWP.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@
148148
<PackageReference Include="MSTest.TestFramework">
149149
<Version>2.1.2</Version>
150150
</PackageReference>
151+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
151152
<PackageReference Include="System.Runtime.CompilerServices.Unsafe">
152153
<Version>5.0.0</Version>
153154
</PackageReference>

UnitTests/UnitTests.NetCore/UnitTests.NetCore.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
<PackageReference Include="FluentAssertions" Version="5.10.3" />
1717
<PackageReference Include="MSTest.TestAdapter" Version="2.1.2" />
1818
<PackageReference Include="MSTest.TestFramework" Version="2.1.2" />
19-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
20-
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.5" />
19+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
20+
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.2" />
2121
</ItemGroup>
2222

2323
<!-- Workaround for the .NET Core 2.1 binary not resolving the Unsafe assembly properly -->

UnitTests/UnitTests.Notifications.NetCore/UnitTests.Notifications.NetCore.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<ItemGroup>
1212
<PackageReference Include="MSTest.TestAdapter" Version="2.1.2" />
1313
<PackageReference Include="MSTest.TestFramework" Version="2.1.2" />
14-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
14+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
1515
</ItemGroup>
1616

1717
<Import Project="..\UnitTests.Notifications.Shared\UnitTests.Notifications.Shared.projitems" Label="Shared" />

UnitTests/UnitTests.Notifications.UWP/UnitTests.Notifications.UWP.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@
122122
<PackageReference Include="MSTest.TestFramework">
123123
<Version>2.1.2</Version>
124124
</PackageReference>
125+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
125126
<PackageReference Include="System.ValueTuple">
126127
<Version>4.5.0</Version>
127128
</PackageReference>

UnitTests/UnitTests.SourceGenerators/UnitTests.SourceGenerators.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<ItemGroup>
1010
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="3.10.0-1.final" />
11-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.1" />
11+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
1212
<PackageReference Include="MSTest.TestAdapter" Version="2.1.2" />
1313
<PackageReference Include="MSTest.TestFramework" Version="2.1.2" />
1414
</ItemGroup>

UnitTests/UnitTests.UWP/App.xaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<Application x:Class="UnitTests.App"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:behaviors="using:Microsoft.Toolkit.Uwp.UI.Behaviors"
5+
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
6+
xmlns:helpers="using:UnitTests.Extensions.Helpers"
7+
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
8+
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
9+
xmlns:ui="using:Microsoft.Toolkit.Uwp.UI"
10+
xmlns:unitTestExtensions="using:UnitTests.Extensions"
11+
RequestedTheme="Light">
12+
<Application.Resources>
13+
<muxc:XamlControlsResources>
14+
<muxc:XamlControlsResources.MergedDictionaries>
15+
<ResourceDictionary>
16+
<!-- Workarounds for .NET Native issue in unit tests -->
17+
<ui:EnumValuesExtension x:Key="DummyExtension" />
18+
19+
<unitTestExtensions:Animal x:Key="Animal">Cat</unitTestExtensions:Animal>
20+
21+
<CommandBar x:Key="DummyCommandBar">
22+
<AppBarButton Icon="{ui:FontIcon Glyph=&#xE102;}" />
23+
<AppBarButton Icon="{ui:SymbolIcon Symbol=Play}" />
24+
</CommandBar>
25+
26+
<unitTestExtensions:MockSwipeItem x:Key="DummySwipeControl1"
27+
IconSource="{ui:FontIconSource Glyph=&#xE10B;}" />
28+
29+
<unitTestExtensions:MockSwipeItem x:Key="DummySwipeControl2"
30+
IconSource="{ui:SymbolIconSource Symbol=Play}" />
31+
32+
<unitTestExtensions:MockSwipeItem x:Key="DummySwipeControl3"
33+
IconSource="{ui:BitmapIconSource Source=/Assets/StoreLogo.png}" />
34+
35+
<Button x:Key="DummyButton">
36+
<Button.Flyout>
37+
<MenuFlyout>
38+
<MenuFlyoutItem Icon="{ui:BitmapIcon Source=/Assets/StoreLogo.png}" />
39+
</MenuFlyout>
40+
</Button.Flyout>
41+
</Button>
42+
43+
<TextBox x:Key="DummyTextBox">
44+
<interactivity:Interaction.Behaviors>
45+
<behaviors:AutoSelectBehavior />
46+
</interactivity:Interaction.Behaviors>
47+
</TextBox>
48+
49+
<controls:ConstrainedBox x:Key="TestConstrainedBox" />
50+
<controls:UniformGrid x:Key="TestUniformGrid" />
51+
<controls:WrapPanel x:Key="TestWrapPanel" />
52+
<ui:NullableBoolExtension x:Key="nullableBool" />
53+
54+
<helpers:ObjectWithNullableBoolProperty x:Key="objectWithNullableBoolProperty" />
55+
</ResourceDictionary>
56+
</muxc:XamlControlsResources.MergedDictionaries>
57+
</muxc:XamlControlsResources>
58+
</Application.Resources>
59+
</Application>

UnitTests/UnitTests.UWP/UnitTestApp.xaml.cs renamed to UnitTests/UnitTests.UWP/App.xaml.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5+
using Microsoft.VisualStudio.TestTools.UnitTesting.Logging;
56
using System;
67
using UnitTests.Extensions;
78
using Windows.ApplicationModel;
@@ -90,6 +91,17 @@ protected override void OnLaunched(LaunchActivatedEventArgs e)
9091
// TODO: Load state from previously suspended application
9192
}
9293

94+
Logger.LogMessage("Looking for DefaultRichEditBoxStyle...");
95+
if (!Resources.TryGetValue("DefaultRichEditBoxStyle", out var value))
96+
{
97+
Logger.LogMessage("ERROR: Couldn't find DefaultRichEditBoxStyle in WinUI!");
98+
throw new ApplicationException("Couldn't find DefaultRichEditBoxStyle resource.");
99+
}
100+
else
101+
{
102+
Logger.LogMessage("FOUND!");
103+
}
104+
93105
// Place the frame in the current Window
94106
Window.Current.Content = rootFrame;
95107
}

UnitTests/UnitTests.UWP/UnitTestApp.xaml

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)