Skip to content

Commit bfc1ea9

Browse files
committed
Align ProjectTemplate test namespaces to avoid component class name conflicts.
- Components with classes matching the component name had an invalid namespace declared for test projects. - Previously, the test namespace would have looked like `ComponentNameExperiment.Tests`, but was changed to look like `ComponentName.Tests`. - In places where `ComponentName` is an existing class, this causes the observed error. -We were unable to use a unified namespace here due to the layout change it causes in the Visual Studio Test Explorer, breaking the existing grouping. - To fix the issue "'SomeComponent' is a namespace but is used like a type" while keeping known behavior, we simply remove the `.` in namespace declarations for `SomeComponent.Tests`.
1 parent a73b34f commit bfc1ea9

File tree

6 files changed

+6
-6
lines changed

6 files changed

+6
-6
lines changed

ProjectHeads/SingleComponent/Tests.Uwp/ProjectTemplate.Tests.Uwp.csproj

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

2222
<PropertyGroup>
2323
<ProjectGuid>{7134BD2E-0A74-4345-868A-E425FC452A89}</ProjectGuid>
24-
<RootNamespace>ProjectTemplate.Tests</RootNamespace>
24+
<RootNamespace>ProjectTemplateTests</RootNamespace>
2525
<AssemblyName>ProjectTemplate.Tests.Uwp</AssemblyName>
2626
<UnitTestPlatformVersion Condition="'$(UnitTestPlatformVersion)' == ''">$(VisualStudioVersion)</UnitTestPlatformVersion>
2727
</PropertyGroup>

ProjectHeads/SingleComponent/Tests.Wasdk/ProjectTemplate.Tests.Wasdk.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<Import Project="$(ToolingDirectory)\ProjectHeads\Tests.Head.WinAppSdk.props" />
1919

2020
<PropertyGroup>
21-
<RootNamespace>ProjectTemplate.Tests</RootNamespace>
21+
<RootNamespace>ProjectTemplateTests</RootNamespace>
2222
<AssemblyName>ProjectTemplate.Tests.WinAppSdk</AssemblyName>
2323
</PropertyGroup>
2424

ProjectTemplate/tests/ExampleProjectTemplateTestClass.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
using CommunityToolkit.Tests;
77
using CommunityToolkit.WinUI.Controls;
88

9-
namespace ProjectTemplate.Tests;
9+
namespace ProjectTemplateTests;
1010

1111
[TestClass]
1212
public partial class ExampleProjectTemplateTestClass : VisualUITestBase

ProjectTemplate/tests/ExampleProjectTemplateTestPage.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!-- 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. -->
2-
<Page x:Class="ProjectTemplate.Tests.ExampleProjectTemplateTestPage"
2+
<Page x:Class="ProjectTemplateTests.ExampleProjectTemplateTestPage"
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
55
xmlns:controls="using:CommunityToolkit.WinUI.Controls"

ProjectTemplate/tests/ExampleProjectTemplateTestPage.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +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-
namespace ProjectTemplate.Tests;
5+
namespace ProjectTemplateTests;
66

77
/// <summary>
88
/// An empty page that can be used on its own or navigated to within a Frame.

ProjectTemplate/tests/ProjectTemplate.Tests.projitems

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<SharedGUID>19AC7A6A-B001-45AA-ACBE-0536F688DB74</SharedGUID>
77
</PropertyGroup>
88
<PropertyGroup Label="Configuration">
9-
<Import_RootNamespace>ProjectTemplate.Tests</Import_RootNamespace>
9+
<Import_RootNamespace>ProjectTemplateTests</Import_RootNamespace>
1010
</PropertyGroup>
1111
<ItemGroup>
1212
<Compile Include="$(MSBuildThisFileDirectory)ExampleProjectTemplateTestClass.cs" />

0 commit comments

Comments
 (0)