test(benchmarks): add C#/ASP.NET and TypeScript tasks
Six tasks with hidden checks: ASP.NET validation and 404 handling, C# cancellation, and TypeScript overlap, deep merge, and debounce fixes, checked with dotnet run and node --test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
97879fd6a5
commit
f43a2df14b
30 files changed
+349
-2
No files matched your search
@@ -0,0 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<FrameworkReference Include="Microsoft.AspNetCore.App" />
|
||||
<ProjectReference Include="..\..\src\Crm\Crm.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,18 @@
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using Microsoft.AspNetCore.Hosting.Server;
|
||||
using Microsoft.AspNetCore.Hosting.Server.Features;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
var app = Crm.AppHost.Build(new[] { "--urls", "http://127.0.0.1:0" });
|
||||
await app.StartAsync();
|
||||
var address = app.Services.GetRequiredService<IServer>().Features.Get<IServerAddressesFeature>()!.Addresses.First();
|
||||
using var client = new HttpClient { BaseAddress = new Uri(address) };
|
||||
var failures = new List<string>();
|
||||
var known = await client.GetAsync("/customers/1");
|
||||
if (known.StatusCode != HttpStatusCode.OK || !(await known.Content.ReadAsStringAsync()).Contains("Ada")) failures.Add($"known customer -> {(int)known.StatusCode}");
|
||||
var unknown = await client.GetAsync("/customers/42");
|
||||
if (unknown.StatusCode != HttpStatusCode.NotFound) failures.Add($"unknown customer -> {(int)unknown.StatusCode}");
|
||||
await app.StopAsync();
|
||||
foreach (var failure in failures) Console.Error.WriteLine("FAIL " + failure);
|
||||
return failures.Count == 0 ? 0 : 1;
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace Crm;
|
||||
|
||||
public static class AppHost
|
||||
{
|
||||
// Integration tests start the application through Build.
|
||||
public static WebApplication Build(string[] args)
|
||||
{
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
var app = builder.Build();
|
||||
var customers = new Dictionary<int, Customer> { [1] = new(1, "Ada") };
|
||||
app.MapGet("/customers/{id:int}", (int id) => customers[id]);
|
||||
return app;
|
||||
}
|
||||
}
|
||||
|
||||
public record Customer(int Id, string Name);
|
||||
@@ -0,0 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1 @@
|
||||
Crm.AppHost.Build(args).Run();
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"prompt": "Requesting an unknown customer with GET /customers/{id} returns HTTP 500. Return 404 instead, and keep known customers working.",
|
||||
"check": [
|
||||
"dotnet",
|
||||
"run",
|
||||
"--project",
|
||||
"bench_hidden/Check",
|
||||
"--nologo"
|
||||
],
|
||||
"workflow": {
|
||||
"kind": "C#/ASP.NET change"
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user