Skip to content

Commit

Permalink
Rewrite part of the project
Browse files Browse the repository at this point in the history
- System.CommandLine is completely removed.
  We use Asp.Net's configuration provider to parse commandline argument.
- `E5Renewer.Modules.YamlParser` and `E5Renewer.Modules.TomlParser` are removed.
  They are in E5Renewer.dll now. But modules support is still existing.
- `IConfigParser` is removed.
  Because we use Asp.Net Core's configuration providers, this is useless now.
  User secret parsing is splited into a new module `IUserSecretLoader`.
  • Loading branch information
arenekosreal committed Nov 21, 2024
1 parent 5f9a738 commit f1753d4
Show file tree
Hide file tree
Showing 72 changed files with 1,707 additions and 1,693 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
os:
- "windows-latest"
- "ubuntu-latest"
#- "macos-latest"
- "macos-latest"
dotnet:
- "8.0"
runs-on: ${{ matrix.os }}
Expand All @@ -37,9 +37,6 @@ jobs:
- name: "Construct files"
run: |
cp -r E5Renewer/bin/Release/net${{ matrix.dotnet }}/publish dist
mkdir -p dist/modules
cp -r E5Renewer.Modules.TomlParser/bin/Release/net${{ matrix.dotnet }}/publish dist/modules/E5Renewer.Modules.TomlParser
cp -r E5Renewer.Modules.YamlParser/bin/Release/net${{ matrix.dotnet }}/publish dist/modules/E5Renewer.Modules.YamlParser
- name: "Create archive"
run: "7z a E5Renewer-${{ steps.build-env-info.outputs.system }}-${{ steps.build-env-info.outputs.machine }}.7z ./dist/*"
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>0.1.0</Version>
<Version>0.2.0</Version>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<Deterministic>true</Deterministic>
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion E5Renewer.Modules.TomlParser.Tests/GlobalUsings.cs

This file was deleted.

41 changes: 0 additions & 41 deletions E5Renewer.Modules.TomlParser.Tests/TomlParserTests.cs

This file was deleted.

22 changes: 0 additions & 22 deletions E5Renewer.Modules.TomlParser/E5Renewer.Modules.TomlParser.csproj

This file was deleted.

48 changes: 0 additions & 48 deletions E5Renewer.Modules.TomlParser/TomlParser.cs

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion E5Renewer.Modules.YamlParser.Tests/GlobalUsings.cs

This file was deleted.

43 changes: 0 additions & 43 deletions E5Renewer.Modules.YamlParser.Tests/YamlParserTests.cs

This file was deleted.

22 changes: 0 additions & 22 deletions E5Renewer.Modules.YamlParser/E5Renewer.Modules.YamlParser.csproj

This file was deleted.

44 changes: 0 additions & 44 deletions E5Renewer.Modules.YamlParser/YamlParser.cs

This file was deleted.

23 changes: 20 additions & 3 deletions E5Renewer.Tests/Controllers/JsonAPIV1ControllerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Microsoft.Extensions.Logging;

using NSubstitute;
using Microsoft.AspNetCore.Http;

namespace E5Renewer.Tests.Controllers;

Expand All @@ -30,11 +31,18 @@ public JsonAPIV1ControllerTests()

IAPIFunction apiFunction = Substitute.For<IAPIFunction>();
apiFunction.id.Returns("test");

List<IAPIFunction> apiFunctions = [apiFunction];
IUnixTimestampGenerator generator = new UnixTimestampGenerator();

this.controller = new(logger, statusManager, apiFunctions, generator);
IUnixTimestampGenerator generator = Substitute.For<IUnixTimestampGenerator>();
generator.GetUnixTimestamp().Returns((long)42);

IDummyResultGenerator dummyResultGenerator = Substitute.For<IDummyResultGenerator>();
InvokeResult dummyResult = new();
HttpContext context = new DefaultHttpContext();
dummyResultGenerator.GenerateDummyResultAsync(context).ReturnsForAnyArgs(dummyResult);
dummyResultGenerator.GenerateDummyResult(context).ReturnsForAnyArgs(dummyResult);

this.controller = new(logger, statusManager, apiFunctions, generator, dummyResultGenerator);
}
/// <summary>Test
/// <see cref="JsonAPIV1Controller.GetListApis" />
Expand Down Expand Up @@ -85,4 +93,13 @@ public async Task TestGetUserResults()
string? status = ((IEnumerable<string>?)result.result)?.First();
Assert.AreEqual("200 - OK", status);
}
/// <summary>Test
/// <see cfef="JsonAPIV1Controller.Handle" />
/// </summary>
[TestMethod]
public async Task TestHandle()
{
InvokeResult result = await this.controller.Handle();
Assert.AreEqual(new(), result);
}
}
Loading

0 comments on commit f1753d4

Please sign in to comment.