Skip to content

Commit 6cabfc8

Browse files
committed
Fix snapshot test path on Helix
1 parent f1fcf50 commit 6cabfc8

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

src/OpenApi/test/Microsoft.AspNetCore.OpenApi.SourceGenerators.Tests/Helpers/SnapshotTestHelper.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Text;
66
using Microsoft.AspNetCore.Hosting.Server;
77
using Microsoft.AspNetCore.Http.Features;
8+
using Microsoft.AspNetCore.InternalTesting;
89
using Microsoft.CodeAnalysis;
910
using Microsoft.CodeAnalysis.CSharp;
1011
using Microsoft.CodeAnalysis.Emit;
@@ -48,8 +49,9 @@ public static Task Verify(string source, IIncrementalGenerator generator, out Co
4849
var driver = CSharpGeneratorDriver.Create(generators: [generator.AsSourceGenerator()], parseOptions: ParseOptions);
4950
return Verifier
5051
.Verify(driver.RunGeneratorsAndUpdateCompilation(inputCompilation, out compilation, out var diagnostics))
51-
.AutoVerify()
52-
.UseDirectory("../snapshots");
52+
.UseDirectory(SkipOnHelixAttribute.OnHelix()
53+
? Path.Combine(Environment.GetEnvironmentVariable("HELIX_WORKITEM_ROOT"), "snapshots")
54+
: "../snapshots");
5355
}
5456

5557
public static async Task VerifyOpenApi(Compilation compilation, Action<OpenApiDocument> verifyFunc)

src/OpenApi/test/Microsoft.AspNetCore.OpenApi.SourceGenerators.Tests/Microsoft.AspNetCore.OpenApi.SourceGenerators.Tests.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,8 @@
3030
<ProjectReference Include="..\..\gen\Microsoft.AspNetCore.OpenApi.SourceGenerators.csproj" />
3131
</ItemGroup>
3232

33+
<ItemGroup>
34+
<HelixContent Include="$(MSBuildProjectDirectory)\snapshots\**" LinkBase="$(MSBuildThisFileDirectory)\snapshots"/>
35+
</ItemGroup>
36+
3337
</Project>

src/OpenApi/test/Microsoft.AspNetCore.OpenApi.SourceGenerators.Tests/snapshots/SchemaTests.SupportsXmlCommentsOnSchemas#OpenApiXmlCommentSupport.generated.verified.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ file static class XmlCommentCache
7979
_cache.Add((typeof(global::Project), null), new XmlComment("""The project that contains <a href=\"#/components/schemas/Todo\">Todo</a> items.""", null,null,null,null,false, new List<string>{}, new List<XmlParameterComment>{} ,new List<XmlResponseComment>{}));
8080
_cache.Add((typeof(global::ProjectBoard.BoardItem), null), new XmlComment("""An item on the board.""", null,null,null,null,false, new List<string>{}, new List<XmlParameterComment>{} ,new List<XmlResponseComment>{}));
8181
_cache.Add((typeof(global::ProjectRecord), null), new XmlComment("""The project that contains <a href=\"#/components/schemas/Todo\">Todo</a> items.""", null,null,null,null,false, new List<string>{}, new List<XmlParameterComment>{new XmlParameterComment(@"Name", @"The name of the project.", null, false), new XmlParameterComment(@"Description", @"The description of the project.", null, false), } ,new List<XmlResponseComment>{}));
82-
_cache.Add((typeof(global::IUser), null), new XmlComment("""Represents a user in the system.""", null,null,null,null,false, new List<string>{}, new List<XmlParameterComment>{} ,new List<XmlResponseComment>{}));
8382
_cache.Add((typeof(global::User), null), new XmlComment(null,null,null,null,null,false, new List<string>{}, new List<XmlParameterComment>{} ,new List<XmlResponseComment>{}));
8483
_cache.Add((typeof(global::ProjectRecord), "Name"), new XmlComment("""The name of the project.""", null,null,null,null,false, new List<string>{}, new List<XmlParameterComment>{} ,new List<XmlResponseComment>{}));
8584
_cache.Add((typeof(global::ProjectRecord), "Description"), new XmlComment("""The description of the project.""", null,null,null,null,false, new List<string>{}, new List<XmlParameterComment>{} ,new List<XmlResponseComment>{}));
@@ -245,7 +244,7 @@ file static class JsonNodeExtensions
245244
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.AspNetCore.OpenApi.SourceGenerators, Version=42.42.42.42, Culture=neutral, PublicKeyToken=adb9793829ddae60", "42.42.42.42")]
246245
file static class GeneratedServiceCollectionExtensions
247246
{
248-
[global::System.Runtime.CompilerServices.InterceptsLocationAttribute(1, "MUoNMEheN1FO70WBdPr5waMAAABQcm9ncmFtLmNz")]
247+
[global::System.Runtime.CompilerServices.InterceptsLocationAttribute(1, "UZZADqQajYC9HbHNRWW5LaMAAABQcm9ncmFtLmNz")]
249248
public static IServiceCollection AddOpenApi(this IServiceCollection services)
250249
{
251250
return services.AddOpenApi("v1", options =>

0 commit comments

Comments
 (0)