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); } }