diff --git a/CommunityToolkit.Tooling.SampleGen.Tests/CommunityToolkit.Tooling.SampleGen.Tests.csproj b/CommunityToolkit.Tooling.SampleGen.Tests/CommunityToolkit.Tooling.SampleGen.Tests.csproj index 629c9e5..ce89f17 100644 --- a/CommunityToolkit.Tooling.SampleGen.Tests/CommunityToolkit.Tooling.SampleGen.Tests.csproj +++ b/CommunityToolkit.Tooling.SampleGen.Tests/CommunityToolkit.Tooling.SampleGen.Tests.csproj @@ -1,18 +1,14 @@ - + net8.0 enable - - false preview + true - - - diff --git a/CommunityToolkit.Tooling.SampleGen.Tests/MSTestConfig.cs b/CommunityToolkit.Tooling.SampleGen.Tests/MSTestConfig.cs new file mode 100644 index 0000000..53a7743 --- /dev/null +++ b/CommunityToolkit.Tooling.SampleGen.Tests/MSTestConfig.cs @@ -0,0 +1,8 @@ +// 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 Microsoft.VisualStudio.TestTools.UnitTesting; + +[assembly: Parallelize(Scope = ExecutionScope.MethodLevel, Workers = 0)] +[assembly: ClassCleanupExecution(ClassCleanupBehavior.EndOfClass)] diff --git a/CommunityToolkit.Tooling.SampleGen.Tests/ToolkitSampleGeneratedPaneTests.cs b/CommunityToolkit.Tooling.SampleGen.Tests/ToolkitSampleGeneratedPaneTests.cs index 6189b32..0e2ea3b 100644 --- a/CommunityToolkit.Tooling.SampleGen.Tests/ToolkitSampleGeneratedPaneTests.cs +++ b/CommunityToolkit.Tooling.SampleGen.Tests/ToolkitSampleGeneratedPaneTests.cs @@ -4,9 +4,7 @@ using CommunityToolkit.Tooling.SampleGen.Diagnostics; using CommunityToolkit.Tooling.SampleGen.Tests.Helpers; -using Microsoft.CodeAnalysis; using Microsoft.VisualStudio.TestTools.UnitTesting; -using System.Linq; namespace CommunityToolkit.Tooling.SampleGen.Tests; diff --git a/CommunityToolkit.Tooling.SampleGen.Tests/ToolkitSampleMetadataTests.Documentation.cs b/CommunityToolkit.Tooling.SampleGen.Tests/ToolkitSampleMetadataTests.Documentation.cs index a61df3b..ce4c166 100644 --- a/CommunityToolkit.Tooling.SampleGen.Tests/ToolkitSampleMetadataTests.Documentation.cs +++ b/CommunityToolkit.Tooling.SampleGen.Tests/ToolkitSampleMetadataTests.Documentation.cs @@ -300,7 +300,7 @@ Which is valid. result.AssertNoCompilationErrors(); - Assert.AreEqual(result.Compilation.GetFileContentsByName("ToolkitDocumentRegistry.g.cs"), """ + Assert.AreEqual(""" #nullable enable namespace CommunityToolkit.Tooling.SampleGen; @@ -311,6 +311,6 @@ public static class ToolkitDocumentRegistry yield return new CommunityToolkit.Tooling.SampleGen.Metadata.ToolkitFrontMatter() { ComponentName = "Primitives", Title = "Canvas Layout", Author = "mhawker", Description = "A canvas-like VirtualizingLayout for use in an ItemsRepeater", Keywords = "CanvasLayout, ItemsRepeater, VirtualizingLayout, Canvas, Layout, Panel, Arrange", Category = ToolkitSampleCategory.Controls, Subcategory = ToolkitSampleSubcategory.Layout, DiscussionId = 0, IssueId = 0, Icon = @"assets/icon.png", FilePath = @"experiment\samples\documentation.md", SampleIdReferences = new string[] { "Sample" }, IsExperimental = true, CsProjName = @"componentname.csproj" }; } } - """, "Unexpected code generated"); + """, result.Compilation.GetFileContentsByName("ToolkitDocumentRegistry.g.cs"), "Unexpected code generated"); } } diff --git a/CommunityToolkit.Tooling.SampleGen.Tests/ToolkitSampleMetadataTests.cs b/CommunityToolkit.Tooling.SampleGen.Tests/ToolkitSampleMetadataTests.cs index 218a332..4be5bca 100644 --- a/CommunityToolkit.Tooling.SampleGen.Tests/ToolkitSampleMetadataTests.cs +++ b/CommunityToolkit.Tooling.SampleGen.Tests/ToolkitSampleMetadataTests.cs @@ -5,8 +5,6 @@ using CommunityToolkit.Tooling.SampleGen.Diagnostics; using CommunityToolkit.Tooling.SampleGen.Tests.Helpers; using Microsoft.VisualStudio.TestTools.UnitTesting; -using System.Collections.Immutable; -using System.ComponentModel.DataAnnotations; namespace CommunityToolkit.Tooling.SampleGen.Tests; diff --git a/CommunityToolkit.Tooling.TestGen.Tests/CommunityToolkit.Tooling.TestGen.Tests.csproj b/CommunityToolkit.Tooling.TestGen.Tests/CommunityToolkit.Tooling.TestGen.Tests.csproj index c68f7e0..5d94852 100644 --- a/CommunityToolkit.Tooling.TestGen.Tests/CommunityToolkit.Tooling.TestGen.Tests.csproj +++ b/CommunityToolkit.Tooling.TestGen.Tests/CommunityToolkit.Tooling.TestGen.Tests.csproj @@ -1,17 +1,13 @@ - + net8.0 enable - - false + true - - - diff --git a/CommunityToolkit.Tooling.TestGen.Tests/MSTestConfig.cs b/CommunityToolkit.Tooling.TestGen.Tests/MSTestConfig.cs new file mode 100644 index 0000000..53a7743 --- /dev/null +++ b/CommunityToolkit.Tooling.TestGen.Tests/MSTestConfig.cs @@ -0,0 +1,8 @@ +// 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 Microsoft.VisualStudio.TestTools.UnitTesting; + +[assembly: Parallelize(Scope = ExecutionScope.MethodLevel, Workers = 0)] +[assembly: ClassCleanupExecution(ClassCleanupBehavior.EndOfClass)] diff --git a/CommunityToolkit.Tooling.TestGen.Tests/UIThreadTestMethodTests.cs b/CommunityToolkit.Tooling.TestGen.Tests/UIThreadTestMethodTests.cs index fa484c1..7d751a8 100644 --- a/CommunityToolkit.Tooling.TestGen.Tests/UIThreadTestMethodTests.cs +++ b/CommunityToolkit.Tooling.TestGen.Tests/UIThreadTestMethodTests.cs @@ -340,10 +340,10 @@ from assembly in AppDomain.CurrentDomain.GetAssemblies() driver = driver.RunGeneratorsAndUpdateCompilation(compilation, out Compilation outputCompilation, out ImmutableArray diagnostics); HashSet resultingIds = diagnostics.Select(diagnostic => diagnostic.Id).ToHashSet(); - var generatedCompilationDiaghostics = outputCompilation.GetDiagnostics(); + var generatedCompilationDiagnostics = outputCompilation.GetDiagnostics(); Assert.IsTrue(resultingIds.SetEquals(diagnosticsIds), $"Expected one of [{string.Join(", ", diagnosticsIds)}] diagnostic Ids. Got [{string.Join(", ", resultingIds)}]"); - Assert.IsTrue(generatedCompilationDiaghostics.All(x => x.Severity != DiagnosticSeverity.Error), $"Expected no generated compilation errors. Got: \n{string.Join("\n", generatedCompilationDiaghostics.Where(x => x.Severity == DiagnosticSeverity.Error).Select(x => $"[{x.Id}: {x.GetMessage()}]"))}"); + Assert.IsTrue(generatedCompilationDiagnostics.All(x => x.Severity != DiagnosticSeverity.Error), $"Expected no generated compilation errors. Got: \n{string.Join("\n", generatedCompilationDiagnostics.Where(x => x.Severity == DiagnosticSeverity.Error).Select(x => $"[{x.Id}: {x.GetMessage()}]"))}"); GC.KeepAlive(attributeType); diff --git a/ProjectHeads/Tests.Head.WinAppSdk.props b/ProjectHeads/Tests.Head.WinAppSdk.props index 2e30626..ef652c6 100644 --- a/ProjectHeads/Tests.Head.WinAppSdk.props +++ b/ProjectHeads/Tests.Head.WinAppSdk.props @@ -6,7 +6,7 @@ - + build diff --git a/ProjectHeads/Tests.Head.props b/ProjectHeads/Tests.Head.props index 447cef5..382fb14 100644 --- a/ProjectHeads/Tests.Head.props +++ b/ProjectHeads/Tests.Head.props @@ -10,8 +10,7 @@ - - + diff --git a/global.json b/global.json index 27a1877..8210b41 100644 --- a/global.json +++ b/global.json @@ -3,8 +3,9 @@ "version": "9.0.101", "rollForward": "latestFeature" }, - "msbuild-sdks": + "msbuild-sdks": { - "MSBuild.Sdk.Extras":"3.0.23" + "MSBuild.Sdk.Extras":"3.0.23", + "MSTest.Sdk": "3.7.3" } }