Skip to content

Commit

Permalink
Add Unit Test
Browse files Browse the repository at this point in the history
Also use solution file instead single project
  • Loading branch information
arenekosreal committed May 10, 2024
1 parent d62d0aa commit 6027637
Show file tree
Hide file tree
Showing 47 changed files with 1,025 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: "nuget"
directory: "/"
schedule:
interval: "weekly"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
28 changes: 28 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
workflow_dispatch:

jobs:
build:
name: "Build packages"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout"
uses: "actions/checkout@v4"
- name: "Setup python"
uses: "actions/setup-python@v5"
with:
python-version: "3.11"
- name: "Setup poetry"
uses: "Gr1N/setup-poetry@v9"
- name: "Install depends"
run: "poetry install"
- name: "Build wheel"
run: "poetry build"
- name: "Create release"
uses: "softprops/action-gh-release@v2"
with:
files: "dist/*"
generate_release_notes: true
29 changes: 29 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: "Run tests"
on:
push:
branches:
- "main"
pull_request:
branches:
- "main"
workflow_dispatch:

jobs:
test:
name: "Run tests"
strategy:
matrix:
os:
- "windows-latest"
- "ubuntu-latest"
- "macos-latest"
runs-on: ${{ matrix.os }}
steps:
- name: "Checkout"
uses: "actions/checkout@v4"
- name: "Setup python"
uses: "actions/setup-dotnet@v4"
with:
dotnet-version: '8'
- name: "Run test"
run: 'dotnet test --collect "XPlat Code Coverage"'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
bin
obj
config.json
TestResults
32 changes: 32 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Contribution guide for E5Renewer

Hello, very glad to know that you are going to make contributions to this project! But we have some code quality requirements. Don't worry, we will list them below.

Before you want to change the repository, please make a fork, everything listed below is done in your fork.

We think you have already read [README.md](README.md) about how to setup poetry and python environment.
But if we are wrong, please feel free to go there to setup dotnet environment.
Here are steps to prepare a development environment:

Run `dotnet restore` in the repository to install them.

Yes, just one step! So easy, doesn't it? Then you can do changes to this project as you like, such as fixing bugs, adding features, etc.
Please do not forget to add some tests for your changes, this is optional but helps preventing bugs at development stage.

After you finish your masterpiece, don't hurry to commit and push directly, please run `dotnet test` to make sure all tests are passed.
We have set running ruff to check code format and quality, so if theres something wrong raised by ruff, please follow outputs to fix it.

After no error is raised, you can `git add` and `git commit` your changes.
We have no many rules/limits on commit message, just one request: let us know what you are doing in the commit.
For example, you can write like this in commit message:
```
Add xxx feature
```
or with some extra description:
```
Add xxx feature
This helps xxx
```

Finally, you can push changes to your repository and create a pull request so we can merge it after everything is checked.
26 changes: 26 additions & 0 deletions E5Renewer.Tests/E5Renewer.Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.3.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.3.1" />
<PackageReference Include="coverlet.collector" Version="6.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\E5Renewer\E5Renewer.csproj" />
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions E5Renewer.Tests/GlobalUsings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
global using Microsoft.VisualStudio.TestTools.UnitTesting;
10 changes: 10 additions & 0 deletions E5Renewer.Tests/UnitTest1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace E5Renewer.Tests;

[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
}
}
48 changes: 48 additions & 0 deletions E5Renewer.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "E5Renewer", "E5Renewer\E5Renewer.csproj", "{F895338E-CD48-473C-8604-89C57CBA0353}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "E5Renewer.Tests", "E5Renewer.Tests\E5Renewer.Tests.csproj", "{74395711-5B07-4A82-841B-FCF2FF33D8D9}"
EndProject
Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F895338E-CD48-473C-8604-89C57CBA0353}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F895338E-CD48-473C-8604-89C57CBA0353}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F895338E-CD48-473C-8604-89C57CBA0353}.Debug|x64.ActiveCfg = Debug|Any CPU
{F895338E-CD48-473C-8604-89C57CBA0353}.Debug|x64.Build.0 = Debug|Any CPU
{F895338E-CD48-473C-8604-89C57CBA0353}.Debug|x86.ActiveCfg = Debug|Any CPU
{F895338E-CD48-473C-8604-89C57CBA0353}.Debug|x86.Build.0 = Debug|Any CPU
{F895338E-CD48-473C-8604-89C57CBA0353}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F895338E-CD48-473C-8604-89C57CBA0353}.Release|Any CPU.Build.0 = Release|Any CPU
{F895338E-CD48-473C-8604-89C57CBA0353}.Release|x64.ActiveCfg = Release|Any CPU
{F895338E-CD48-473C-8604-89C57CBA0353}.Release|x64.Build.0 = Release|Any CPU
{F895338E-CD48-473C-8604-89C57CBA0353}.Release|x86.ActiveCfg = Release|Any CPU
{F895338E-CD48-473C-8604-89C57CBA0353}.Release|x86.Build.0 = Release|Any CPU
{74395711-5B07-4A82-841B-FCF2FF33D8D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{74395711-5B07-4A82-841B-FCF2FF33D8D9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{74395711-5B07-4A82-841B-FCF2FF33D8D9}.Debug|x64.ActiveCfg = Debug|Any CPU
{74395711-5B07-4A82-841B-FCF2FF33D8D9}.Debug|x64.Build.0 = Debug|Any CPU
{74395711-5B07-4A82-841B-FCF2FF33D8D9}.Debug|x86.ActiveCfg = Debug|Any CPU
{74395711-5B07-4A82-841B-FCF2FF33D8D9}.Debug|x86.Build.0 = Debug|Any CPU
{74395711-5B07-4A82-841B-FCF2FF33D8D9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{74395711-5B07-4A82-841B-FCF2FF33D8D9}.Release|Any CPU.Build.0 = Release|Any CPU
{74395711-5B07-4A82-841B-FCF2FF33D8D9}.Release|x64.ActiveCfg = Release|Any CPU
{74395711-5B07-4A82-841B-FCF2FF33D8D9}.Release|x64.Build.0 = Release|Any CPU
{74395711-5B07-4A82-841B-FCF2FF33D8D9}.Release|x86.ActiveCfg = Release|Any CPU
{74395711-5B07-4A82-841B-FCF2FF33D8D9}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 6027637

Please sign in to comment.