From 8f5a624c7332e3990b4b4fb31fbc13ed4328642c Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 5 Jul 2024 08:36:05 -0400 Subject: [PATCH] ci: fixes preview generated code unit test failure introduced by #4907 Signed-off-by: Vincent Biret --- .../Writers/CSharp/CodeClassDeclarationWriterTests.cs | 3 +-- .../Kiota.Builder.Tests/Writers/CSharp/CodeEnumWriterTests.cs | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/Kiota.Builder.Tests/Writers/CSharp/CodeClassDeclarationWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/CSharp/CodeClassDeclarationWriterTests.cs index dcb3867f5d..d59f8e58d5 100644 --- a/tests/Kiota.Builder.Tests/Writers/CSharp/CodeClassDeclarationWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/CSharp/CodeClassDeclarationWriterTests.cs @@ -113,7 +113,6 @@ public void WritesGeneratedCodeAttribute() { codeElementWriter.WriteCodeElement(parentClass.StartBlock, writer); var result = tw.ToString(); - var pattern = @"\s+\[global::System\.CodeDom\.Compiler\.GeneratedCode\(""Kiota"", ""[0-9]+\.[0-9]+\.[0-9]+\""\)\]"; - Assert.Matches(pattern, result); + Assert.Matches(CodeEnumWriterTests.GeneratedCodePattern, result); } } diff --git a/tests/Kiota.Builder.Tests/Writers/CSharp/CodeEnumWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/CSharp/CodeEnumWriterTests.cs index 3cba9639ce..bbbd6fd2f5 100644 --- a/tests/Kiota.Builder.Tests/Writers/CSharp/CodeEnumWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/CSharp/CodeEnumWriterTests.cs @@ -130,13 +130,13 @@ public void DoesntWriteAnythingOnNoOption() Assert.Empty(result); } + internal const string GeneratedCodePattern = @"\s+\[global::System\.CodeDom\.Compiler\.GeneratedCode\(""Kiota"", ""[0-9]+\.[0-9]+\.[0-9]+(?:-preview\.\d+)?""\)\]"; [Fact] public void WritesGeneratedCodeAttribute() { currentEnum.AddOption(new CodeEnumOption { Name = "option2" }); writer.Write(currentEnum); var result = tw.ToString(); - var pattern = @"\s+\[global::System\.CodeDom\.Compiler\.GeneratedCode\(""Kiota"", ""[0-9]+\.[0-9]+\.[0-9]+\""\)\]"; - Assert.Matches(pattern, result); + Assert.Matches(GeneratedCodePattern, result); } }