From 05be524a9c66a7cc2776d1d1fc1a07c4be5b7d65 Mon Sep 17 00:00:00 2001 From: Benjamin Michaelis Date: Thu, 25 Jan 2024 22:52:11 -0800 Subject: [PATCH] revert global.json update --- .../TestGeneratorTests.cs | 45 +++++++++++++++++++ global.json | 2 +- 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/Moq.AutoMocker.TestGenerator.Tests/TestGeneratorTests.cs b/Moq.AutoMocker.TestGenerator.Tests/TestGeneratorTests.cs index af67d9b4..fe30f37d 100644 --- a/Moq.AutoMocker.TestGenerator.Tests/TestGeneratorTests.cs +++ b/Moq.AutoMocker.TestGenerator.Tests/TestGeneratorTests.cs @@ -326,6 +326,51 @@ partial class ControllerTests }.RunAsync(); } + [TestMethod] + public async Task Generation_ParameterWithNullableStringAndDefaultValue_DoesNotGenerateTest() + { + var code = @" +#nullable enable +using Moq.AutoMock; +using System.Threading; + +namespace TestNamespace; + +[ConstructorTests(typeof(Controller), TestGenerationBehavior.IgnoreNullableParameters)] +public partial class ControllerTests +{ + +} + +public class Controller +{ + public Controller(string? name = null) { } +} +"; + string expected = @"namespace TestNamespace +{ + partial class ControllerTests + { + partial void AutoMockerTestSetup(Moq.AutoMock.AutoMocker mocker, string testName); + + } +} +"; + + await new VerifyCS.Test + { + TestCode = code, + TestState = + { + GeneratedSources = + { + GetSourceFile(expected, "ControllerTests.g.cs") + } + } + + }.RunAsync(); + } + [TestMethod] public async Task Generation_ParameterWithNullableValueType_DoesNotGenerateTest() { diff --git a/global.json b/global.json index bc54e196..a071fad8 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "8.0.100", + "version": "6.0.400", "rollForward": "latestMinor" } } \ No newline at end of file