Skip to content

Commit 6dc39a4

Browse files
authored
Merge pull request #6 from Crequency/dev=main
[Pull Request] 一些新增功能, 完善单元测试, 新增示例网站
2 parents 1965ad9 + a704bf4 commit 6dc39a4

54 files changed

Lines changed: 1821 additions & 926 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/codecov.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: CodeCov
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
paths-ignore:
8+
- ".*/**"
9+
- "**/*.md"
10+
pull_request:
11+
branches:
12+
- "main"
13+
paths-ignore:
14+
- ".*/**"
15+
- "**/*.md"
16+
17+
workflow_dispatch:
18+
19+
jobs:
20+
codecov:
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Upload coverage reports to Codecov
25+
uses: codecov/codecov-action@v3
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net7.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.4" />
11+
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
12+
</ItemGroup>
13+
14+
<ItemGroup>
15+
<ProjectReference Include="..\Common.BasicHelper\Common.BasicHelper.csproj" />
16+
</ItemGroup>
17+
18+
</Project>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
using Common.BasicHelper.Core.Shell;
2+
using Common.BasicHelper.Utils.Extensions;
3+
using System.Web;
4+
5+
var builder = WebApplication.CreateBuilder(args);
6+
7+
// Add services to the container.
8+
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
9+
builder.Services.AddEndpointsApiExplorer();
10+
builder.Services.AddSwaggerGen();
11+
12+
var app = builder.Build();
13+
14+
// Configure the HTTP request pipeline.
15+
if (app.Environment.IsDevelopment())
16+
{
17+
app.UseSwagger();
18+
app.UseSwaggerUI();
19+
}
20+
21+
app.UseHttpsRedirection();
22+
23+
app.MapGet("/Utils/Extensions/StringHelper/ExecuteAsCommand/{cmd}.{args?}",
24+
(string cmd, string? args) => cmd.ExecuteAsCommand(
25+
args == "," || args == "{args}" || args.IsNullOrWhiteSpace()
26+
? null : HttpUtility.UrlDecode(args)
27+
)
28+
)
29+
.WithName("ExecuteAsCommand")
30+
.WithOpenApi();
31+
32+
app.MapGet("/Utils/Extensions/StringHelper/ExecuteAsCommandAsync/{cmd}.{args?}",
33+
async (string cmd, string? args) => await cmd.ExecuteAsCommandAsync(
34+
args == "," || args == "{args}" || args.IsNullOrWhiteSpace()
35+
? null : HttpUtility.UrlDecode(args)
36+
)
37+
)
38+
.WithName("ExecuteAsCommandAsync")
39+
.WithOpenApi();
40+
41+
app.Run();
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"$schema": "https://json.schemastore.org/launchsettings.json",
3+
"iisSettings": {
4+
"windowsAuthentication": false,
5+
"anonymousAuthentication": true,
6+
"iisExpress": {
7+
"applicationUrl": "http://localhost:40529",
8+
"sslPort": 44396
9+
}
10+
},
11+
"profiles": {
12+
"http": {
13+
"commandName": "Project",
14+
"dotnetRunMessages": true,
15+
"launchBrowser": false,
16+
"launchUrl": "swagger",
17+
"applicationUrl": "http://localhost:5077",
18+
"environmentVariables": {
19+
"ASPNETCORE_ENVIRONMENT": "Development"
20+
}
21+
},
22+
"https": {
23+
"commandName": "Project",
24+
"dotnetRunMessages": true,
25+
"launchBrowser": false,
26+
"launchUrl": "swagger",
27+
"applicationUrl": "https://localhost:7219;http://localhost:5077",
28+
"environmentVariables": {
29+
"ASPNETCORE_ENVIRONMENT": "Development"
30+
}
31+
},
32+
"IIS Express": {
33+
"commandName": "IISExpress",
34+
"launchBrowser": true,
35+
"launchUrl": "swagger",
36+
"environmentVariables": {
37+
"ASPNETCORE_ENVIRONMENT": "Development"
38+
}
39+
}
40+
}
41+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace Common.BasicHelper.Samples.Utils.Extensions;
2+
3+
public static class StringHelper
4+
{
5+
6+
7+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft.AspNetCore": "Warning"
6+
}
7+
}
8+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft.AspNetCore": "Warning"
6+
}
7+
},
8+
"AllowedHosts": "*"
9+
}

Common.BasicHelper.Test/Common.BasicHelper.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net7.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
namespace Common.BasicHelper.Core.Shell;
2+
3+
[TestClass]
4+
public class CommandsExecutor_Tests
5+
{
6+
[TestMethod]
7+
public void Test_ExecuteAsCommand()
8+
{
9+
Console.WriteLine("help".ExecuteAsCommand());
10+
}
11+
12+
[TestMethod]
13+
public async Task Test_ExecuteAsCommandAsync()
14+
{
15+
Console.WriteLine(await "help".ExecuteAsCommandAsync());
16+
}
17+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
namespace Common.BasicHelper.Core.Shell;
2+
3+
public class EnvironmentHelper_Tests
4+
{
5+
}

0 commit comments

Comments
 (0)