diff --git a/.editorconfig b/.editorconfig index 1ebeacd..f592296 100644 --- a/.editorconfig +++ b/.editorconfig @@ -525,6 +525,120 @@ csharp_style_prefer_top_level_statements = true:silent csharp_style_prefer_primary_constructors = true:suggestion csharp_style_prefer_local_over_anonymous_function = true:suggestion + +############################################# +# NUnit Analyzers — enable all as errors +############################################# + +# Structure Rules (NUnit1001 - ) +dotnet_diagnostic.NUnit1001.severity = error # TestCase args must match parameter types +dotnet_diagnostic.NUnit1002.severity = error # TestCaseSource should use nameof +dotnet_diagnostic.NUnit1003.severity = error # TestCase provided too few arguments +dotnet_diagnostic.NUnit1004.severity = error # TestCase provided too many arguments +dotnet_diagnostic.NUnit1005.severity = error # ExpectedResult type must match return type +dotnet_diagnostic.NUnit1006.severity = error # ExpectedResult must not be used on void methods +dotnet_diagnostic.NUnit1007.severity = error # Non-void method but no ExpectedResult provided +dotnet_diagnostic.NUnit1008.severity = error # ParallelScope.Self at assembly level has no effect +dotnet_diagnostic.NUnit1009.severity = error # ParallelScope.Children on non-parameterized test +dotnet_diagnostic.NUnit1010.severity = error # ParallelScope.Fixtures on a test method +dotnet_diagnostic.NUnit1011.severity = error # TestCaseSource member does not exist +dotnet_diagnostic.NUnit1012.severity = error # async test method must have non-void return type +dotnet_diagnostic.NUnit1013.severity = error # async method must use non-generic Task when no result +dotnet_diagnostic.NUnit1014.severity = error # async method must use Task when result expected +dotnet_diagnostic.NUnit1015.severity = error # Source type does not implement I(Async)Enumerable +dotnet_diagnostic.NUnit1016.severity = error # Source type lacks default constructor +dotnet_diagnostic.NUnit1017.severity = error # Specified source is not static +dotnet_diagnostic.NUnit1018.severity = error # TestCaseSource param count mismatch (target method) +dotnet_diagnostic.NUnit1019.severity = error # Source does not return I(Async)Enumerable +dotnet_diagnostic.NUnit1020.severity = error # Parameters provided to field/property source +dotnet_diagnostic.NUnit1021.severity = error # ValueSource should use nameof +dotnet_diagnostic.NUnit1022.severity = error # Specified ValueSource is not static +dotnet_diagnostic.NUnit1023.severity = error # ValueSource cannot supply required parameters +dotnet_diagnostic.NUnit1024.severity = error # ValueSource does not return I(Async)Enumerable +dotnet_diagnostic.NUnit1025.severity = error # ValueSource member does not exist +dotnet_diagnostic.NUnit1026.severity = error # Test or setup/teardown method is not public +dotnet_diagnostic.NUnit1027.severity = error # Test method has parameters but no arguments supplied +dotnet_diagnostic.NUnit1028.severity = error # Non-test method is public +dotnet_diagnostic.NUnit1029.severity = error # TestCaseSource param count mismatch (Test method) +dotnet_diagnostic.NUnit1030.severity = error # TestCaseSource parameter type mismatch (Test method) +dotnet_diagnostic.NUnit1031.severity = error # ValuesAttribute args must match parameter types +dotnet_diagnostic.NUnit1032.severity = error # IDisposable field/property should be disposed in TearDown +dotnet_diagnostic.NUnit1033.severity = error # TestContext.Write methods will be obsolete +dotnet_diagnostic.NUnit1034.severity = error # Base TestFixtures should be abstract +dotnet_diagnostic.NUnit1035.severity = error # Range 'step' parameter cannot be zero +dotnet_diagnostic.NUnit1036.severity = error # Range: from < to when step is positive +dotnet_diagnostic.NUnit1037.severity = error # Range: from > to when step is negative +dotnet_diagnostic.NUnit1038.severity = error # Attribute values' types must match parameter type + +# Assertion Rules (NUnit2001 - ) +dotnet_diagnostic.NUnit2001.severity = error # Prefer Assert.That(..., Is.False) over ClassicAssert.False +dotnet_diagnostic.NUnit2002.severity = error # Prefer Assert.That(..., Is.False) over ClassicAssert.IsFalse +dotnet_diagnostic.NUnit2003.severity = error # Prefer Assert.That(..., Is.True) over ClassicAssert.IsTrue +dotnet_diagnostic.NUnit2004.severity = error # Prefer Assert.That(..., Is.True) over ClassicAssert.True +dotnet_diagnostic.NUnit2005.severity = error # Prefer Is.EqualTo over AreEqual +dotnet_diagnostic.NUnit2006.severity = error # Prefer Is.Not.EqualTo over AreNotEqual +dotnet_diagnostic.NUnit2007.severity = error # Actual value should not be a constant +dotnet_diagnostic.NUnit2008.severity = error # Incorrect IgnoreCase usage +dotnet_diagnostic.NUnit2009.severity = error # Same value used for actual and expected +dotnet_diagnostic.NUnit2010.severity = error # Use EqualConstraint for better messages +dotnet_diagnostic.NUnit2011.severity = error # Use ContainsConstraint for better messages +dotnet_diagnostic.NUnit2012.severity = error # Use StartsWithConstraint for better messages +dotnet_diagnostic.NUnit2013.severity = error # Use EndsWithConstraint for better messages +dotnet_diagnostic.NUnit2014.severity = error # Use SomeItemsConstraint for better messages +dotnet_diagnostic.NUnit2015.severity = error # Prefer Is.SameAs over AreSame +dotnet_diagnostic.NUnit2016.severity = error # Prefer Is.Null over ClassicAssert.Null +dotnet_diagnostic.NUnit2017.severity = error # Prefer Is.Null over ClassicAssert.IsNull +dotnet_diagnostic.NUnit2018.severity = error # Prefer Is.Not.Null over ClassicAssert.NotNull +dotnet_diagnostic.NUnit2019.severity = error # Prefer Is.Not.Null over ClassicAssert.IsNotNull +dotnet_diagnostic.NUnit2020.severity = error # Incompatible types for SameAs constraint +dotnet_diagnostic.NUnit2021.severity = error # Incompatible types for EqualTo constraint +dotnet_diagnostic.NUnit2022.severity = error # Missing property required for constraint +dotnet_diagnostic.NUnit2023.severity = error # Invalid NullConstraint usage +dotnet_diagnostic.NUnit2024.severity = error # Wrong actual type with String constraint +dotnet_diagnostic.NUnit2025.severity = error # Wrong actual type with ContainsConstraint +dotnet_diagnostic.NUnit2026.severity = error # Wrong actual type with SomeItems+EqualConstraint +dotnet_diagnostic.NUnit2027.severity = error # Prefer Is.GreaterThan over ClassicAssert.Greater +dotnet_diagnostic.NUnit2028.severity = error # Prefer Is.GreaterThanOrEqualTo over GreaterOrEqual +dotnet_diagnostic.NUnit2029.severity = error # Prefer Is.LessThan over ClassicAssert.Less +dotnet_diagnostic.NUnit2030.severity = error # Prefer Is.LessThanOrEqualTo over LessOrEqual +dotnet_diagnostic.NUnit2031.severity = error # Prefer Is.Not.SameAs over AreNotSame +dotnet_diagnostic.NUnit2032.severity = error # Prefer Is.Zero over ClassicAssert.Zero +dotnet_diagnostic.NUnit2033.severity = error # Prefer Is.Not.Zero over ClassicAssert.NotZero +dotnet_diagnostic.NUnit2034.severity = error # Prefer Is.NaN over ClassicAssert.IsNaN +dotnet_diagnostic.NUnit2035.severity = error # Prefer Is.Empty over ClassicAssert.IsEmpty +dotnet_diagnostic.NUnit2036.severity = error # Prefer Is.Not.Empty over ClassicAssert.IsNotEmpty +dotnet_diagnostic.NUnit2037.severity = error # Prefer Does.Contain over ClassicAssert.Contains +dotnet_diagnostic.NUnit2038.severity = error # Prefer Is.InstanceOf over ClassicAssert.IsInstanceOf +dotnet_diagnostic.NUnit2039.severity = error # Prefer Is.Not.InstanceOf over ClassicAssert.IsNotInstanceOf +dotnet_diagnostic.NUnit2040.severity = error # Non-reference types for SameAs constraint +dotnet_diagnostic.NUnit2041.severity = error # Incompatible types for comparison constraint +dotnet_diagnostic.NUnit2042.severity = error # Comparison constraint on object +dotnet_diagnostic.NUnit2043.severity = error # Use ComparisonConstraint for better messages +dotnet_diagnostic.NUnit2044.severity = error # Non-delegate actual parameter +dotnet_diagnostic.NUnit2045.severity = error # Use Assert.EnterMultipleScope or Assert.Multiple +dotnet_diagnostic.NUnit2046.severity = error # Use CollectionConstraint for better messages +dotnet_diagnostic.NUnit2047.severity = error # Incompatible types for Within constraint +dotnet_diagnostic.NUnit2048.severity = error # Prefer Assert.That over StringAssert +dotnet_diagnostic.NUnit2049.severity = error # Prefer Assert.That over CollectionAssert +dotnet_diagnostic.NUnit2050.severity = error # NUnit 4 no longer supports string.Format spec +dotnet_diagnostic.NUnit2051.severity = error # Prefer Is.Positive over ClassicAssert.Positive +dotnet_diagnostic.NUnit2052.severity = error # Prefer Is.Negative over ClassicAssert.Negative +dotnet_diagnostic.NUnit2053.severity = error # Prefer Is.AssignableFrom over ClassicAssert.IsAssignableFrom +dotnet_diagnostic.NUnit2054.severity = error # Prefer Is.Not.AssignableFrom over ClassicAssert.IsNotAssignableFrom +dotnet_diagnostic.NUnit2055.severity = error # Prefer Is.InstanceOf over 'is T' expression +dotnet_diagnostic.NUnit2056.severity = error # Prefer Assert.EnterMultipleScope statement over Multiple + +# Suppressor Rules (NUnit3001 - ) +dotnet_diagnostic.NUnit3001.severity = error # Expression checked in NotNull/IsNotNull/Assert.That +dotnet_diagnostic.NUnit3002.severity = error # Field/Property initialized in SetUp/OneTimeSetUp +dotnet_diagnostic.NUnit3003.severity = error # TestFixture instantiated via reflection +dotnet_diagnostic.NUnit3004.severity = error # Field should be disposed in TearDown/OneTimeTearDown + +# Style Rules (NUnit4001 - ) +dotnet_diagnostic.NUnit4001.severity = error # Simplify the Values attribute +dotnet_diagnostic.NUnit4002.severity = error # Use Specific constraint + + # C++ Files [*.{cpp,h,in}] curly_bracket_next_line = true @@ -551,5 +665,3 @@ indent_size = 2 end_of_line = lf [*.{cmd, bat}] end_of_line = crlf - -vsspell_dictionary_languages = en-US \ No newline at end of file diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 787f38d..2d47b1f 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -37,6 +37,25 @@ true + + + + + netstandard2.0 + + net8.0;net9.0;net10.0 + + + + + + net9.0-android;net10.0-android + + net9.0-android;net9.0-ios;net9.0-maccatalyst;net10.0-android;net10.0-ios;net10.0-maccatalyst + + net9.0-android;net9.0-ios;net9.0-maccatalyst;net9.0-windows10.0.19041.0;net10.0-android;net10.0-ios;net10.0-maccatalyst;net10.0-windows10.0.19041.0 + + diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 0ca7199..5facb6c 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -31,16 +31,14 @@ - - - - - - + + + + - + diff --git a/src/ReactiveUI.SourceGenerator.Tests/AssemblyInfo.Parallel.cs b/src/ReactiveUI.SourceGenerator.Tests/AssemblyInfo.Parallel.cs new file mode 100644 index 0000000..b8b31d4 --- /dev/null +++ b/src/ReactiveUI.SourceGenerator.Tests/AssemblyInfo.Parallel.cs @@ -0,0 +1,9 @@ +// Copyright (c) 2025 ReactiveUI and contributors. All rights reserved. +// Licensed to the ReactiveUI and contributors under one or more agreements. +// The ReactiveUI and contributors licenses this file to you under the MIT license. +// See the LICENSE file in the project root for full license information. + +using NUnit.Framework; + +[assembly: Parallelizable(ParallelScope.Fixtures)] +[assembly: LevelOfParallelism(4)] diff --git a/src/ReactiveUI.SourceGenerator.Tests/ReactiveUI.SourceGenerators.Tests.csproj b/src/ReactiveUI.SourceGenerator.Tests/ReactiveUI.SourceGenerators.Tests.csproj index dbcb328..8630fcf 100644 --- a/src/ReactiveUI.SourceGenerator.Tests/ReactiveUI.SourceGenerators.Tests.csproj +++ b/src/ReactiveUI.SourceGenerator.Tests/ReactiveUI.SourceGenerators.Tests.csproj @@ -1,7 +1,7 @@  - net8.0 + $(TestTfms) enable enable 13.0 @@ -16,10 +16,11 @@ - - + + + - + @@ -27,11 +28,10 @@ - - + diff --git a/src/ReactiveUI.SourceGenerator.Tests/TestBase.cs b/src/ReactiveUI.SourceGenerator.Tests/TestBase.cs index ed8220c..186e396 100644 --- a/src/ReactiveUI.SourceGenerator.Tests/TestBase.cs +++ b/src/ReactiveUI.SourceGenerator.Tests/TestBase.cs @@ -4,7 +4,6 @@ // See the LICENSE file in the project root for full license information. using Microsoft.CodeAnalysis; -using Xunit.Abstractions; namespace ReactiveUI.SourceGenerator.Tests; @@ -12,25 +11,29 @@ namespace ReactiveUI.SourceGenerator.Tests; /// A base class for handling test setup and teardown. /// /// Type of Incremental Generator. -/// /// -/// The output helper. -public abstract class TestBase(ITestOutputHelper testOutputHelper) : IAsyncLifetime, IDisposable +public abstract class TestBase : IDisposable where T : IIncrementalGenerator, new() { /// /// Gets the TestHelper instance. /// - protected TestHelper TestHelper { get; } = new(testOutputHelper); + protected TestHelper TestHelper { get; } = new(); - /// + /// + /// Initializes the test helper asynchronously. + /// + /// A task representing the asynchronous operation. + [OneTimeSetUp] public Task InitializeAsync() => TestHelper.InitializeAsync(); - /// - public Task DisposeAsync() + /// + /// Disposes the test helper. + /// + [OneTimeTearDown] + public void DisposeAsync() { TestHelper.Dispose(); - return Task.CompletedTask; } /// diff --git a/src/ReactiveUI.SourceGenerator.Tests/TestHelper.cs b/src/ReactiveUI.SourceGenerator.Tests/TestHelper.cs index 395c7be..1c095c1 100644 --- a/src/ReactiveUI.SourceGenerator.Tests/TestHelper.cs +++ b/src/ReactiveUI.SourceGenerator.Tests/TestHelper.cs @@ -3,8 +3,6 @@ // The ReactiveUI and contributors licenses this file to you under the MIT license. // See the LICENSE file in the project root for full license information. -using FluentAssertions; - using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; @@ -12,6 +10,8 @@ using NuGet.LibraryModel; using NuGet.Versioning; +using NUnit.Framework; + using ReactiveMarbles.NuGet.Helpers; using ReactiveMarbles.SourceGenerator.TestNuGetHelper.Compilation; @@ -19,8 +19,6 @@ using ReactiveUI.SourceGenerators; using ReactiveUI.SourceGenerators.WinForms; -using Xunit.Abstractions; - namespace ReactiveUI.SourceGenerator.Tests; /// @@ -29,8 +27,7 @@ namespace ReactiveUI.SourceGenerator.Tests; /// /// Type of Incremental Generator. /// -/// The test output helper for capturing test logs. -public sealed class TestHelper(ITestOutputHelper testOutput) : IDisposable +public sealed class TestHelper : IDisposable where T : IIncrementalGenerator, new() { #pragma warning disable CS0618 // Type or member is obsolete @@ -127,7 +124,7 @@ public void TestFail( throw new InvalidOperationException("Must have valid compiler instance."); } - var utility = new SourceGeneratorUtility(x => testOutput.WriteLine(x)); + var utility = new SourceGeneratorUtility(x => TestContext.Out.WriteLine(x)); #pragma warning disable IDE0053 // Use expression body for lambda expression #pragma warning disable RCS1021 // Convert lambda expression body to expression body @@ -204,7 +201,7 @@ public SettingsTask RunGeneratorAndCheck( var prediagnostics = compilation.GetDiagnostics() .Where(d => d.Severity > DiagnosticSeverity.Warning) .ToList(); - prediagnostics.Should().BeEmpty(); + Assert.That(prediagnostics, Is.Empty); } var generator = new T(); @@ -224,7 +221,7 @@ public SettingsTask RunGeneratorAndCheck( { foreach (var diagnostic in offendingDiagnostics) { - testOutput.WriteLine($"Diagnostic: {diagnostic.Id} - {diagnostic.GetMessage()}"); + TestContext.Out.WriteLine($"Diagnostic: {diagnostic.Id} - {diagnostic.GetMessage()}"); } throw new InvalidOperationException("Compilation failed due to the above diagnostics."); diff --git a/src/ReactiveUI.SourceGenerator.Tests/UnitTests/BindableDerivedListGeneratorTests.cs b/src/ReactiveUI.SourceGenerator.Tests/UnitTests/BindableDerivedListGeneratorTests.cs index ec4d102..e973067 100644 --- a/src/ReactiveUI.SourceGenerator.Tests/UnitTests/BindableDerivedListGeneratorTests.cs +++ b/src/ReactiveUI.SourceGenerator.Tests/UnitTests/BindableDerivedListGeneratorTests.cs @@ -4,20 +4,20 @@ // See the LICENSE file in the project root for full license information. using ReactiveUI.SourceGenerators; -using Xunit.Abstractions; namespace ReactiveUI.SourceGenerator.Tests; /// /// BindableDerivedListGeneratorTests. /// -public class BindableDerivedListGeneratorTests(ITestOutputHelper output) : TestBase(output) +[TestFixture] +public class BindableDerivedListGeneratorTests : TestBase { /// /// Tests that the source generator correctly generates reactive properties. /// /// A task to monitor the async. - [Fact] + [Test] public Task FromReactiveProperties() { // Arrange: Setup the source code that matches the generator input expectations. diff --git a/src/ReactiveUI.SourceGenerator.Tests/UnitTests/IViewForGeneratorTests.cs b/src/ReactiveUI.SourceGenerator.Tests/UnitTests/IViewForGeneratorTests.cs index b1001cd..723e1c3 100644 --- a/src/ReactiveUI.SourceGenerator.Tests/UnitTests/IViewForGeneratorTests.cs +++ b/src/ReactiveUI.SourceGenerator.Tests/UnitTests/IViewForGeneratorTests.cs @@ -4,20 +4,20 @@ // See the LICENSE file in the project root for full license information. using ReactiveUI.SourceGenerators; -using Xunit.Abstractions; namespace ReactiveUI.SourceGenerator.Tests; /// /// IViewForGeneratorTests. /// -public class IViewForGeneratorTests(ITestOutputHelper output) : TestBase(output) +[TestFixture] +public class IViewForGeneratorTests : TestBase { /// /// Tests that the source generator correctly generates reactive properties. /// /// A task to monitor the async. - [Fact] + [Test] public Task FromIViewFor() { // Arrange: Setup the source code that matches the generator input expectations. diff --git a/src/ReactiveUI.SourceGenerator.Tests/UnitTests/OAPFromObservableGeneratorTests.cs b/src/ReactiveUI.SourceGenerator.Tests/UnitTests/OAPFromObservableGeneratorTests.cs index 428583a..d906dda 100644 --- a/src/ReactiveUI.SourceGenerator.Tests/UnitTests/OAPFromObservableGeneratorTests.cs +++ b/src/ReactiveUI.SourceGenerator.Tests/UnitTests/OAPFromObservableGeneratorTests.cs @@ -4,21 +4,20 @@ // See the LICENSE file in the project root for full license information. using ReactiveUI.SourceGenerators; -using Xunit.Abstractions; namespace ReactiveUI.SourceGenerator.Tests; /// /// Unit tests for the ObservableAsProperty generator. /// -/// The output helper. -public class OAPFromObservableGeneratorTests(ITestOutputHelper output) : TestBase(output) +[TestFixture] +public class OAPFromObservableGeneratorTests : TestBase { /// /// Tests that the source generator correctly generates observable properties. /// /// A task to monitor the async. - [Fact] + [Test] public Task FromObservableProp() { // Arrange: Setup the source code that matches the generator input expectations. @@ -45,7 +44,7 @@ public partial class TestVM : ReactiveObject /// Tests that the source generator correctly generates observable properties. /// /// A task to monitor the async. - [Fact] + [Test] public Task FromObservablePropNestedClasses() { // Arrange: Setup the source code that matches the generator input expectations. @@ -90,7 +89,7 @@ public partial class TestVMInner3 : ReactiveObject /// Tests that the source generator correctly generates observable properties. /// /// A task to monitor the async. - [Fact] + [Test] public Task FromObservableMethods() { // Arrange: Setup the source code that matches the generator input expectations. @@ -117,7 +116,7 @@ public partial class TestVM : ReactiveObject /// Tests that the source generator correctly generates observable properties. /// /// A task to monitor the async. - [Fact] + [Test] public Task FromObservableMethodsWithName() { // Arrange: Setup the source code that matches the generator input expectations. @@ -144,7 +143,7 @@ public partial class TestVM : ReactiveObject /// Tests that the source generator correctly generates observable properties. /// /// A task to monitor the async. - [Fact] + [Test] public Task FromObservablePropertiesWithName() { // Arrange: Setup the source code that matches the generator input expectations. @@ -171,7 +170,7 @@ public partial class TestVM : ReactiveObject /// Tests that the source generator correctly generates observable properties. /// /// A task to monitor the async. - [Fact] + [Test] public Task FromObservablePropertiesWithAttribute() { // Arrange: Setup the source code that matches the generator input expectations. @@ -202,7 +201,7 @@ public partial class TestVM : ReactiveObject /// Tests that the source generator correctly generates observable properties. /// /// A task to monitor the async. - [Fact] + [Test] public Task FromObservablePropertiesWithAttributeRef() { // Arrange: Setup the source code that matches the generator input expectations. @@ -233,7 +232,7 @@ public partial class TestVM : ReactiveObject /// Tests that the source generator correctly generates observable properties. /// /// A task to monitor the async. - [Fact] + [Test] public Task FromObservablePropertiesWithAttributeNullableRef() { // Arrange: Setup the source code that matches the generator input expectations. @@ -266,7 +265,7 @@ public partial class TestVM : ReactiveObject /// /// A task to monitor the async. /// - [Fact] + [Test] public Task FromField() { // Arrange: Setup the source code that matches the generator input expectations. @@ -307,7 +306,7 @@ public TestVM() /// /// A task to monitor the async. /// - [Fact] + [Test] public Task FromPartialProperty() { // Arrange: Setup the source code that matches the generator input expectations. diff --git a/src/ReactiveUI.SourceGenerator.Tests/UnitTests/OAPGeneratorTests.cs b/src/ReactiveUI.SourceGenerator.Tests/UnitTests/OAPGeneratorTests.cs index 0bb993b..749860c 100644 --- a/src/ReactiveUI.SourceGenerator.Tests/UnitTests/OAPGeneratorTests.cs +++ b/src/ReactiveUI.SourceGenerator.Tests/UnitTests/OAPGeneratorTests.cs @@ -4,21 +4,20 @@ // See the LICENSE file in the project root for full license information. using ReactiveUI.SourceGenerators; -using Xunit.Abstractions; namespace ReactiveUI.SourceGenerator.Tests; /// /// Unit tests for the ObservableAsProperty generator. /// -/// The output helper. -public class OAPGeneratorTests(ITestOutputHelper output) : TestBase(output) +[TestFixture] +public class OAPGeneratorTests : TestBase { /// /// Tests that the source generator correctly generates observable properties. /// /// A task to monitor the async. - [Fact] + [Test] public Task FromField() { // Arrange: Setup the source code that matches the generator input expectations. @@ -45,7 +44,7 @@ public partial class TestVM : ReactiveObject /// Tests that the source generator correctly generates observable properties. /// /// A task to monitor the async. - [Fact] + [Test] public Task FromFieldNestedClass() { // Arrange: Setup the source code that matches the generator input expectations. @@ -90,7 +89,7 @@ public partial class TestVMInner3 : ReactiveObject /// Tests that the source generator correctly generates observable properties. /// /// A task to monitor the async. - [Fact] + [Test] public Task NonReadOnlyFromField() { // Arrange: Setup the source code that matches the generator input expectations. @@ -117,7 +116,7 @@ public partial class TestVM : ReactiveObject /// Tests that the source generator correctly generates observable properties. /// /// A task to monitor the async. - [Fact] + [Test] public Task NamedFromField() { // Arrange: Setup the source code that matches the generator input expectations. @@ -144,7 +143,7 @@ public partial class TestVM : ReactiveObject /// Tests that the source generator correctly generates observable properties. /// /// A task to monitor the async. - [Fact] + [Test] public Task NonReadOnlyFromFieldProtected() { // Arrange: Setup the source code that matches the generator input expectations. diff --git a/src/ReactiveUI.SourceGenerator.Tests/UnitTests/ReactiveCMDGeneratorTests.cs b/src/ReactiveUI.SourceGenerator.Tests/UnitTests/ReactiveCMDGeneratorTests.cs index 9779f4b..d3b17cc 100644 --- a/src/ReactiveUI.SourceGenerator.Tests/UnitTests/ReactiveCMDGeneratorTests.cs +++ b/src/ReactiveUI.SourceGenerator.Tests/UnitTests/ReactiveCMDGeneratorTests.cs @@ -4,21 +4,20 @@ // See the LICENSE file in the project root for full license information. using ReactiveUI.SourceGenerators; -using Xunit.Abstractions; namespace ReactiveUI.SourceGenerator.Tests; /// /// Unit tests for the ReactiveCommand generator. /// -/// The output helper. -public class ReactiveCMDGeneratorTests(ITestOutputHelper output) : TestBase(output) +[TestFixture] +public class ReactiveCMDGeneratorTests : TestBase { /// /// Tests that the source generator correctly generates ReactiveCommands. /// /// A task to monitor the async. - [Fact] + [Test] public Task FromReactiveCommand() { // Arrange: Setup the source code that matches the generator input expectations. @@ -46,7 +45,7 @@ public partial class TestVM : ReactiveObject /// Tests that the source generator correctly generates ReactiveCommands. /// /// A task to monitor the async. - [Fact] + [Test] public Task FromReactiveCommandWithParameter() { // Arrange: Setup the source code that matches the generator input expectations. @@ -75,7 +74,7 @@ public partial class TestVM : ReactiveObject /// Tests that the source generator correctly generates ReactiveCommands. /// /// A task to monitor the async. - [Fact] + [Test] public Task FromReactiveAsyncCommand() { // Arrange: Setup the source code that matches the generator input expectations. @@ -106,7 +105,7 @@ private async Task Test1() /// Tests that the source generator correctly generates ReactiveCommands. /// /// A task to monitor the async. - [Fact] + [Test] public Task FromReactiveAsyncCommandWithParameter() { // Arrange: Setup the source code that matches the generator input expectations. @@ -138,7 +137,7 @@ private async Task Test3(string baseString) /// Froms the reactive command with output scheduler. /// /// A task to monitor the async. - [Fact] + [Test] public Task FromReactiveCommandWithOutputScheduler() { // Arrange: Setup the source code that matches the generator input expectations. @@ -164,7 +163,7 @@ public partial class TestVM : ReactiveObject /// Froms the reactive command with nested classes. /// /// A task to monitor the async. - [Fact] + [Test] public Task FromReactiveCommandWithNestedClasses() { // Arrange: Setup the source code that matches the generator input expectations. diff --git a/src/ReactiveUI.SourceGenerator.Tests/UnitTests/ReactiveCollectionGeneratorTests.cs b/src/ReactiveUI.SourceGenerator.Tests/UnitTests/ReactiveCollectionGeneratorTests.cs index 233ecac..f3adcc6 100644 --- a/src/ReactiveUI.SourceGenerator.Tests/UnitTests/ReactiveCollectionGeneratorTests.cs +++ b/src/ReactiveUI.SourceGenerator.Tests/UnitTests/ReactiveCollectionGeneratorTests.cs @@ -4,19 +4,19 @@ // See the LICENSE file in the project root for full license information. using ReactiveUI.SourceGenerator.Tests; -using Xunit.Abstractions; namespace ReactiveUI.SourceGenerators.Tests; /// /// ReactiveCollectionGeneratorTests. /// -public class ReactiveCollectionGeneratorTests(ITestOutputHelper output) : TestBase(output) +[TestFixture] +public class ReactiveCollectionGeneratorTests : TestBase { /// /// Tests that the source generator correctly generates reactive properties. /// /// A task to monitor the async. - [Fact] + [Test] public Task FromReactiveCollectionField() { // Arrange: Setup the source code that matches the generator input expectations. diff --git a/src/ReactiveUI.SourceGenerator.Tests/UnitTests/ReactiveGeneratorTests.cs b/src/ReactiveUI.SourceGenerator.Tests/UnitTests/ReactiveGeneratorTests.cs index dbd6fa8..832455a 100644 --- a/src/ReactiveUI.SourceGenerator.Tests/UnitTests/ReactiveGeneratorTests.cs +++ b/src/ReactiveUI.SourceGenerator.Tests/UnitTests/ReactiveGeneratorTests.cs @@ -4,21 +4,20 @@ // See the LICENSE file in the project root for full license information. using ReactiveUI.SourceGenerators; -using Xunit.Abstractions; namespace ReactiveUI.SourceGenerator.Tests; /// /// Unit tests for the Reactive generator. /// -/// The output helper. -public class ReactiveGeneratorTests(ITestOutputHelper output) : TestBase(output) +[TestFixture] +public class ReactiveGeneratorTests : TestBase { /// /// Tests that the source generator correctly generates reactive properties. /// /// A task to monitor the async. - [Fact] + [Test] public Task FromReactiveProperties() { // Arrange: Setup the source code that matches the generator input expectations. @@ -45,7 +44,7 @@ public partial class TestVM : ReactiveObject /// Tests that the source generator correctly generates reactive properties. /// /// A task to monitor the async. - [Fact] + [Test] public Task FromReactivePropertiesCalledValue() { // Arrange: Setup the source code that matches the generator input expectations. @@ -72,7 +71,7 @@ public partial class TestVM : ReactiveObject /// Tests that the source generator correctly generates reactive properties. /// /// A task to monitor the async. - [Fact] + [Test] public Task FromReactivePropertiesWithAccess() { // Arrange: Setup the source code that matches the generator input expectations. @@ -99,7 +98,7 @@ public partial class TestVM : ReactiveObject /// Froms the reactive properies with attributes. /// /// A task to monitor the async. - [Fact] + [Test] public Task FromReactiveProperiesWithAttributes() { // Arrange: Setup the source code that matches the generator input expectations. @@ -130,7 +129,7 @@ public partial class TestVM : ReactiveObject /// Froms the reactive properties with attributes and access and inheritance. /// /// A task to monitor the async. - [Fact] + [Test] public Task FromReactivePropertiesWithAttributesAccessAndInheritance() { // Arrange: Setup the source code that matches the generator input expectations. @@ -161,7 +160,7 @@ public partial class TestVM : ReactiveObject /// Froms the reactive properties with attributes and access and inheritance. /// /// A task to monitor the async. - [Fact] + [Test] public Task FromReactivePropertiesWithIdenticalClass() { // Arrange: Setup the source code that matches the generator input expectations. @@ -204,7 +203,7 @@ public partial class TestVM : ReactiveObject /// Froms the reactive properties with nested class. /// /// A task to monitor the async. - [Fact] + [Test] public Task FromReactivePropertiesWithNestedClass() { // Arrange: Setup the source code that matches the generator input expectations. @@ -277,7 +276,7 @@ public partial class TestInnerClass3 : ReactiveObject /// Tests that the source generator correctly generates reactive properties. /// /// A task to monitor the async. - [Fact] + [Test] public Task FromReactivePropertiesWithInit() { // Arrange: Setup the source code that matches the generator input expectations. @@ -304,7 +303,7 @@ public partial class TestVM : ReactiveObject /// Tests that the source generator correctly generates reactive properties. /// /// A task to monitor the async. - [Fact] + [Test] public Task FromReactivePartialProperties() { // Arrange: Setup the source code that matches the generator input expectations. diff --git a/src/ReactiveUI.SourceGenerators.Analyzers.CodeFixes/ReactiveUI.SourceGenerators.Analyzers.CodeFixes.csproj b/src/ReactiveUI.SourceGenerators.Analyzers.CodeFixes/ReactiveUI.SourceGenerators.Analyzers.CodeFixes.csproj index ba43a47..bec9aff 100644 --- a/src/ReactiveUI.SourceGenerators.Analyzers.CodeFixes/ReactiveUI.SourceGenerators.Analyzers.CodeFixes.csproj +++ b/src/ReactiveUI.SourceGenerators.Analyzers.CodeFixes/ReactiveUI.SourceGenerators.Analyzers.CodeFixes.csproj @@ -1,7 +1,7 @@  - netstandard2.0 + $(RoslynTfm) enable latest true diff --git a/src/ReactiveUI.SourceGenerators.Execute.Maui/ReactiveUI.SourceGenerators.Execute.Maui.csproj b/src/ReactiveUI.SourceGenerators.Execute.Maui/ReactiveUI.SourceGenerators.Execute.Maui.csproj index 9e8cfd1..32309f1 100644 --- a/src/ReactiveUI.SourceGenerators.Execute.Maui/ReactiveUI.SourceGenerators.Execute.Maui.csproj +++ b/src/ReactiveUI.SourceGenerators.Execute.Maui/ReactiveUI.SourceGenerators.Execute.Maui.csproj @@ -1,16 +1,15 @@  - net8.0-android;net8.0-ios;net8.0-maccatalyst - $(TargetFrameworks);net8.0-windows10.0.19041.0 + $(MauiTfms) true enable enable false latest - 11.0 - 13.1 + 12.2 + 15.0 21.0 10.0.17763.0 10.0.17763.0 diff --git a/src/ReactiveUI.SourceGenerators.Execute/TestViewModel.cs b/src/ReactiveUI.SourceGenerators.Execute/TestViewModel.cs index 502e098..853bd42 100644 --- a/src/ReactiveUI.SourceGenerators.Execute/TestViewModel.cs +++ b/src/ReactiveUI.SourceGenerators.Execute/TestViewModel.cs @@ -8,6 +8,7 @@ using System.Reactive; using System.Reactive.Concurrency; using System.Reactive.Disposables; +using System.Reactive.Disposables.Fluent; using System.Reactive.Linq; using System.Reactive.Subjects; using System.Runtime.Serialization; diff --git a/src/ReactiveUI.SourceGenerators.Roslyn/AnalyzerReleases.Shipped.md b/src/ReactiveUI.SourceGenerators.Roslyn/AnalyzerReleases.Shipped.md index 3566637..b040928 100644 --- a/src/ReactiveUI.SourceGenerators.Roslyn/AnalyzerReleases.Shipped.md +++ b/src/ReactiveUI.SourceGenerators.Roslyn/AnalyzerReleases.Shipped.md @@ -20,8 +20,7 @@ RXUISG0013 | ReactiveUI.SourceGenerators.ObservableAsPropertyGenerator | Error | RXUISG0014 | ReactiveUI.SourceGenerators.ObservableAsPropertyGenerator | Error | See https://www.reactiveui.net/docs/handbook/view-models/boilerplate-code.html RXUISG0015 | ReactiveUI.SourceGenerators.ReactiveGenerator | Error | See https://www.reactiveui.net/docs/handbook/view-models/boilerplate-code.html RXUISG0017 | ReactiveUI.SourceGenerators.ObservableAsPropertyFromObservableGenerator | Error | See https://www.reactiveui.net/docs/handbook/view-models/boilerplate-code.html -RXUISG0018 | ReactiveUI.SourceGenerators.ObservableAsPropertyFromObservableGenerator | Error | See https://www.reactiveui.net/docs/handbook/view-models/boilerplate-code.html -RXUISG0018 | ReactiveUI.SourceGenerators.ReactiveGenerator | Error | See https://www.reactiveui.net/docs/handbook/view-models/boilerplate-code.html +RXUISG0018 | ReactiveUI.SourceGenerators.ObservableAsPropertyFromObservableGenerator/ReactiveGenerator | Error | See https://www.reactiveui.net/docs/handbook/view-models/boilerplate-code.html RXUISG0019 | ReactiveUI.SourceGenerators.BindableDerivedListGenerator | Error | See https://www.reactiveui.net/docs/handbook/view-models/boilerplate-code.html ## Rules @@ -78,11 +77,8 @@ This rule checks if there are any Properties to change to Reactive Field, change - RXUISG0017 - ObservableAsPropertyFromObservableGenerator This rule checks if the `ObservableAsProperty` has Invalid generated property declaration. -- RXUISG0018 - ObservableAsPropertyFromObservableGenerator -This rule checks if the `ObservableAsProperty` has Invalid class inheritance, must inherit from `ReactiveObject`. - -- RXUISG0018 - ReactiveGenerator -This rule checks if the `Reactive` has Invalid class inheritance, must inherit from `ReactiveObject`. +- RXUISG0018 - ObservableAsPropertyFromObservableGenerator/ReactiveGenerator +This rule checks if the `ObservableAsProperty` or `Reactive` has Invalid class inheritance, must inherit from `ReactiveObject`. - RXUISG0019 - BindableDerivedListGenerator - This rule checks if the `BindableDerivedList` has Invalid property inheritance type. diff --git a/src/ReactiveUI.SourceGenerators.Roslyn4120/ReactiveUI.SourceGenerators.Roslyn4120.csproj b/src/ReactiveUI.SourceGenerators.Roslyn4120/ReactiveUI.SourceGenerators.Roslyn4120.csproj index 5ecb3c6..660fb21 100644 --- a/src/ReactiveUI.SourceGenerators.Roslyn4120/ReactiveUI.SourceGenerators.Roslyn4120.csproj +++ b/src/ReactiveUI.SourceGenerators.Roslyn4120/ReactiveUI.SourceGenerators.Roslyn4120.csproj @@ -1,7 +1,7 @@  - netstandard2.0 + $(RoslynTfm) enable latest true @@ -29,6 +29,13 @@ - + + + + + + + + diff --git a/src/ReactiveUI.SourceGenerators.Roslyn480/ReactiveUI.SourceGenerators.Roslyn480.csproj b/src/ReactiveUI.SourceGenerators.Roslyn480/ReactiveUI.SourceGenerators.Roslyn480.csproj index 0e6e508..355a953 100644 --- a/src/ReactiveUI.SourceGenerators.Roslyn480/ReactiveUI.SourceGenerators.Roslyn480.csproj +++ b/src/ReactiveUI.SourceGenerators.Roslyn480/ReactiveUI.SourceGenerators.Roslyn480.csproj @@ -1,7 +1,7 @@  - netstandard2.0 + $(RoslynTfm) enable latest true @@ -24,6 +24,13 @@ - + + + + + + + + diff --git a/src/ReactiveUI.SourceGenerators.sln b/src/ReactiveUI.SourceGenerators.sln index 7d6f42d..4984e4b 100644 --- a/src/ReactiveUI.SourceGenerators.sln +++ b/src/ReactiveUI.SourceGenerators.sln @@ -34,8 +34,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReactiveUI.SourceGenerators EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NestedTest", "NestedTest", "{CAFBD27B-5078-4A0C-A4E9-19DCF2A7DF16}" EndProject -Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ReactiveUI.SourceGenerators.Roslyn", "ReactiveUI.SourceGenerators.Roslyn\ReactiveUI.SourceGenerators.Roslyn.shproj", "{BC460DAF-92ED-41D9-9EB4-2C92121D62A8}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReactiveUI.SourceGenerators.Roslyn480", "ReactiveUI.SourceGenerators.Roslyn480\ReactiveUI.SourceGenerators.Roslyn480.csproj", "{7C308972-5697-464F-BEAE-02FE9E03BECE}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReactiveUI.SourceGenerators.Roslyn4120", "ReactiveUI.SourceGenerators.Roslyn4120\ReactiveUI.SourceGenerators.Roslyn4120.csproj", "{BF121262-7F30-4EC0-9F03-324AC3B834B8}" @@ -101,9 +99,4 @@ Global GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {173F891B-86A2-4226-B563-A7318CE0E2EC} EndGlobalSection - GlobalSection(SharedMSBuildProjectFiles) = preSolution - ReactiveUI.SourceGenerators.Roslyn\ReactiveUI.SourceGenerators.Roslyn.projitems*{7c308972-5697-464f-beae-02fe9e03bece}*SharedItemsImports = 5 - ReactiveUI.SourceGenerators.Roslyn\ReactiveUI.SourceGenerators.Roslyn.projitems*{bc460daf-92ed-41d9-9eb4-2c92121d62a8}*SharedItemsImports = 13 - ReactiveUI.SourceGenerators.Roslyn\ReactiveUI.SourceGenerators.Roslyn.projitems*{bf121262-7f30-4ec0-9f03-324ac3b834b8}*SharedItemsImports = 5 - EndGlobalSection EndGlobal diff --git a/src/ReactiveUI.SourceGenerators/ReactiveUI.SourceGenerators.csproj b/src/ReactiveUI.SourceGenerators/ReactiveUI.SourceGenerators.csproj index a18702e..e95b566 100644 --- a/src/ReactiveUI.SourceGenerators/ReactiveUI.SourceGenerators.csproj +++ b/src/ReactiveUI.SourceGenerators/ReactiveUI.SourceGenerators.csproj @@ -1,7 +1,7 @@  - netstandard2.0 + $(RoslynTfm) enable latest true diff --git a/tests.runsettings b/tests.runsettings new file mode 100644 index 0000000..e5d4ab7 --- /dev/null +++ b/tests.runsettings @@ -0,0 +1,6 @@ + + + + 4 + +