浏览代码

modify and add new test : CSharp/akazawayun.pro (#10017)

* add new test : CSharp/akazawayun.pro

* modify config and code

* add content-type

* update url

* update package version
AkazawaYun 1 月之前
父节点
当前提交
18be8bb6e8

+ 1 - 0
frameworks/CSharp/akazawayun.pro/README.md

@@ -0,0 +1 @@
+AkazawaYun.PRO(https://akazawayun.cn/#akzLearning#%E5%BF%AB%E9%80%9F%E5%85%A5%E9%97%A8)

+ 13 - 0
frameworks/CSharp/akazawayun.pro/akazawayun.pro.dockerfile

@@ -0,0 +1,13 @@
+# 此阶段用于生成项目
+FROM mcr.microsoft.com/dotnet/sdk:9.0 AS publish
+WORKDIR /app
+COPY src .
+RUN dotnet publish -c Release -o /app/publish
+
+# 此阶段用于运行
+FROM mcr.microsoft.com/dotnet/sdk:9.0 AS runtime
+WORKDIR /app
+COPY --from=publish /app/publish .
+
+EXPOSE 2022
+ENTRYPOINT ["dotnet", "AkazawaYun.FrameworkBenchmarks.dll"]

+ 25 - 0
frameworks/CSharp/akazawayun.pro/benchmark_config.json

@@ -0,0 +1,25 @@
+{
+    "framework": "akazawayun.pro",
+    "tests": [
+        {
+            "default": {
+                "display_name": "akazawayun.pro",
+                "framework": "akazawayun.pro",
+                "webserver": "akazawayun.pro",
+                "plaintext_url": "/post/plaintext",
+                "json_url": "/post/json",
+                "port": 2022,
+                "classification": "Micro",
+                "approach": "Realistic",
+                "platform": ".NET",
+                "language": "C#",
+                "flavor": "CoreCLR",
+                "os": "Linux",
+                "database_os": "Linux",
+                "database": "MySQL",
+                "orm": "Micro",
+                "notes": ""
+            }
+        }
+    ]
+}

+ 19 - 0
frameworks/CSharp/akazawayun.pro/src/AkazawaYun.FrameworkBenchmarks.csproj

@@ -0,0 +1,19 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <OutputType>Exe</OutputType>
+    <TargetFramework>net9.0</TargetFramework>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <Nullable>enable</Nullable>
+  </PropertyGroup>
+  
+  <PropertyGroup>
+    <ConcurrentGarbageCollection>true</ConcurrentGarbageCollection>
+    <ServerGarbageCollection>true</ServerGarbageCollection>
+  </PropertyGroup>
+  
+  <ItemGroup>
+    <PackageReference Include="AkazawaYun.PRO" Version="1.13.25.727" />
+  </ItemGroup>
+
+</Project>

+ 41 - 0
frameworks/CSharp/akazawayun.pro/src/Program.cs

@@ -0,0 +1,41 @@
+using AkazawaYun.PRO7;
+using AkazawaYun.PRO7.AkazawaYunWebInterceptor;
+using System.Text.Json.Serialization;
+
+namespace AkazawaYun.FrameworkBenchmarks;
+
+public class Program : IPostFunction
+{
+    static async Task Main()
+    {
+        akzJson.Config(null, Json.Default);
+        var server = await akzWebBuilder.Shared.Load().SetDefault().Build()
+            .Config<IWebReceptor, akzWebInterceptor>(itc =>
+            {
+                itc.AddInterceptor(new akzWebInterceptorNotOnlyPost());
+            }).Launch();
+        akzLog.Default = akzLog.Output.None;
+        await Task.Delay(-1);
+    }
+
+
+    public static ValueTask<HttpRes> plaintext(HttpReq _)
+    {
+        return HttpRes.HttpOK("Hello, World!", ".txt");
+    }
+    public static ValueTask<HttpRes> json(HttpReq _)
+    {
+        return HttpRes.HttpJson(new JsonResponse
+        {
+            message = "Hello, World!"
+        });
+    }
+}
+
+public class JsonResponse
+{
+    public string? message { get; set; }
+}
+
+[JsonSerializable(typeof(JsonResponse))]
+public partial class Json : JsonSerializerContext { }