Skip to content

Commit 9b19109

Browse files
committed
Added the unit test project
1 parent 83543f4 commit 9b19109

17 files changed

+217
-2
lines changed

Directory.Packages.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,6 @@
5959
<PackageVersion Include="MSTest.TestAdapter" Version="3.8.3" />
6060
<PackageVersion Include="MSTest.TestFramework" Version="3.8.3" />
6161
<PackageVersion Include="Dongle.GuidRVAGen" Version="1.0.5" />
62+
<PackageVersion Include="Microsoft.TestPlatform.TestHost" Version="17.13.0" />
6263
</ItemGroup>
6364
</Project>

Files.slnx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<File Path="Directory.Packages.props" />
1010
</Folder>
1111
<Folder Name="/src/" />
12-
<Folder Name="/src/core/" Id="8d626ea8-cb54-bc41-363a-217881beba6e">
12+
<Folder Name="/src/core/">
1313
<Project Path="src/Files.Core.SourceGenerator/Files.Core.SourceGenerator.csproj" />
1414
<Project Path="src/Files.Core.Storage/Files.Core.Storage.csproj">
1515
<Platform Solution="*|arm64" Project="arm64" />
@@ -22,7 +22,7 @@
2222
<Platform Solution="*|x86" Project="x86" />
2323
</Project>
2424
</Folder>
25-
<Folder Name="/src/platforms/" Id="82099983-647e-f067-e69a-cd800643a918">
25+
<Folder Name="/src/platforms/">
2626
<Project Path="src/Files.App (Package)/Files.Package.wapproj" Type="c7167f0d-bc9f-4e6e-afe1-012c56b48db5">
2727
<Deploy />
2828
</Project>
@@ -81,6 +81,12 @@
8181
<Platform Solution="*|x86" Project="x86" />
8282
<Deploy />
8383
</Project>
84+
<Project Path="tests/Files.App.UnitTests/Files.App.UnitTests.csproj">
85+
<Platform Solution="*|arm64" Project="ARM64" />
86+
<Platform Solution="*|x64" Project="x64" />
87+
<Platform Solution="*|x86" Project="x86" />
88+
<Deploy />
89+
</Project>
8490
<Project Path="tests/Files.InteractionTests/Files.InteractionTests.csproj">
8591
<Platform Solution="*|arm64" Project="arm64" />
8692
<Platform Solution="*|x64" Project="x64" />

tests/Files.App.UnitTests/App.xaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Application
2+
x:Class="Files.App.UnitTests.App"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:local="using:Files.App.UnitTests">
6+
7+
<Application.Resources>
8+
<ResourceDictionary>
9+
<ResourceDictionary.MergedDictionaries>
10+
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
11+
</ResourceDictionary.MergedDictionaries>
12+
</ResourceDictionary>
13+
</Application.Resources>
14+
15+
</Application>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright (c) Files Community
2+
// Licensed under the MIT License.
3+
4+
using Microsoft.UI.Xaml;
5+
using Microsoft.VisualStudio.TestTools.UnitTesting.AppContainer;
6+
7+
namespace Files.App.UnitTests
8+
{
9+
public partial class App : Application
10+
{
11+
private Window? _window;
12+
13+
public App()
14+
{
15+
InitializeComponent();
16+
}
17+
18+
protected override void OnLaunched(LaunchActivatedEventArgs args)
19+
{
20+
Microsoft.VisualStudio.TestPlatform.TestExecutor.UnitTestClient.CreateDefaultUI();
21+
22+
_window = new MainWindow();
23+
_window.Activate();
24+
25+
UITestMethodAttribute.DispatcherQueue = _window.DispatcherQueue;
26+
27+
Microsoft.VisualStudio.TestPlatform.TestExecutor.UnitTestClient.Run(System.Environment.CommandLine);
28+
}
29+
}
30+
}
432 Bytes
Loading
5.25 KB
Loading
1.71 KB
Loading
637 Bytes
Loading
283 Bytes
Loading
456 Bytes
Loading

0 commit comments

Comments
 (0)