Skip to content

Commit f99bd36

Browse files
Merge pull request #39 - Fixes regarding to Copilot reviews
- use app.Start() in TestWebApplicationProgram - Add comment explaining variable startedServer - Use the same layout-service builder pattern previously used in TrackingBenchmarks
2 parents 617f047 + 496fa60 commit f99bd36

22 files changed

Lines changed: 28 additions & 3 deletions

tests/Sitecore.AspNetCore.SDK.RenderingEngine.Benchmarks/TrackingBenchmarks.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using Microsoft.Extensions.DependencyInjection;
99
using Sitecore.AspNetCore.SDK.AutoFixture.Mocks;
1010
using Sitecore.AspNetCore.SDK.LayoutService.Client.Extensions;
11+
using Sitecore.AspNetCore.SDK.LayoutService.Client.Interfaces;
1112
using Sitecore.AspNetCore.SDK.RenderingEngine.Extensions;
1213
using Sitecore.AspNetCore.SDK.TestData;
1314
using Sitecore.AspNetCore.SDK.Tracking;
@@ -42,8 +43,11 @@ public void TrackingBenchmarksSetup()
4243
ForwardedHeaders.XForwardedProto;
4344
});
4445

45-
services.AddSitecoreLayoutService();
46-
services.AddHttpClient("mock").ConfigurePrimaryHttpMessageHandler(() => _mockClientHandler!);
46+
ISitecoreLayoutClientBuilder layoutBuilder = services.AddSitecoreLayoutService();
47+
layoutBuilder
48+
.AddHttpHandler("mock", _ => new HttpClient(_mockClientHandler!) { BaseAddress = new Uri("http://layout.service") })
49+
.AsDefaultHandler();
50+
4751
services.AddSitecoreRenderingEngine(options =>
4852
{
4953
options.AddDefaultComponentRenderer();

tests/Sitecore.AspNetCore.SDK.RenderingEngine.Integration.Tests/Fixtures/Binding/ComplexModelBindingFixture.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public ComplexModelBindingFixture(TestWebApplicationFactory<TestWebApplicationPr
4747
});
4848
});
4949

50+
// Accessing _factory.Server forces the TestServer to start. The variable is unused; this is intentional.
5051
TestServer startedServer = _factory.Server;
5152
}
5253

tests/Sitecore.AspNetCore.SDK.RenderingEngine.Integration.Tests/Fixtures/Binding/CustomModelContextBindingFixture.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public CustomModelContextBindingFixture(TestWebApplicationFactory<TestWebApplica
4848
});
4949
});
5050

51+
// Accessing _factory.Server forces the TestServer to start. The variable is unused; this is intentional.
5152
TestServer startedServer = _factory.Server;
5253
}
5354

tests/Sitecore.AspNetCore.SDK.RenderingEngine.Integration.Tests/Fixtures/Binding/CustomResolverBindingFixture.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public CustomResolverBindingFixture(TestWebApplicationFactory<TestWebApplication
4949
});
5050
});
5151

52+
// Accessing _factory.Server forces the TestServer to start. The variable is unused; this is intentional.
5253
TestServer startedServer = _factory.Server;
5354
}
5455

tests/Sitecore.AspNetCore.SDK.RenderingEngine.Integration.Tests/Fixtures/Binding/ModelBindingErrorHandlingFixture.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public ModelBindingErrorHandlingFixture(TestWebApplicationFactory<TestWebApplica
4747
});
4848
});
4949

50+
// Accessing _factory.Server forces the TestServer to start. The variable is unused; this is intentional.
5051
TestServer startedServer = _factory.Server;
5152
}
5253

tests/Sitecore.AspNetCore.SDK.RenderingEngine.Integration.Tests/Fixtures/Binding/ViewFieldsBindingFixture.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public ViewFieldsBindingFixture(TestWebApplicationFactory<TestWebApplicationProg
4747
});
4848
});
4949

50+
// Accessing _factory.Server forces the TestServer to start. The variable is unused; this is intentional.
5051
TestServer startedServer = _factory.Server;
5152
}
5253

tests/Sitecore.AspNetCore.SDK.RenderingEngine.Integration.Tests/Fixtures/CustomRenderTypes/LoggingComponentRendererFixture.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public LoggingComponentRendererFixture(TestWebApplicationFactory<TestWebApplicat
4848
});
4949
});
5050

51+
// Accessing _factory.Server forces the TestServer to start. The variable is unused; this is intentional.
5152
TestServer startedServer = _factory.Server;
5253
}
5354

tests/Sitecore.AspNetCore.SDK.RenderingEngine.Integration.Tests/Fixtures/CustomRenderTypes/MultipleComponentsAddedFixture.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public MultipleComponentsAddedFixture(TestWebApplicationFactory<TestWebApplicati
4848
});
4949
});
5050

51+
// Accessing _factory.Server forces the TestServer to start. The variable is unused; this is intentional.
5152
TestServer startedServer = _factory.Server;
5253
}
5354

tests/Sitecore.AspNetCore.SDK.RenderingEngine.Integration.Tests/Fixtures/CustomRenderTypes/PartialViewRendererFixture.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public PartialViewRendererFixture(TestWebApplicationFactory<TestWebApplicationPr
4747
});
4848
});
4949

50+
// Accessing _factory.Server forces the TestServer to start. The variable is unused; this is intentional.
5051
TestServer startedServer = _factory.Server;
5152
}
5253

tests/Sitecore.AspNetCore.SDK.RenderingEngine.Integration.Tests/Fixtures/Pages/PagesEditingFixture.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public PagesEditingFixture(TestWebApplicationFactory<TestWebApplicationProgram>
6262
});
6363
});
6464

65+
// Accessing _factory.Server forces the TestServer to start. The variable is unused; this is intentional.
6566
TestServer startedServer = _factory.Server;
6667
}
6768

0 commit comments

Comments
 (0)