Skip to content

Commit e302c33

Browse files
authored
Merge pull request #1 from Crequency/dev=main
[Pull Request] 新增相关扩展方法; 新增从系统 PATH 中寻找可执行文件的功能; 新增执行命令并获取输出的功能
2 parents bfa9871 + d8a5826 commit e302c33

34 files changed

Lines changed: 1667 additions & 1261 deletions

.github/PULL_REQUEST_TEMPLATE/pull_request_template.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
## What does this MR do?
1+
## What does this PR do?
22

3-
<!-- Briefly describe what this MR is about -->
3+
<!-- Briefly describe what this PR is about -->
44

55
## Related issues
66

.gitlab/merge_request_templates/default.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
## What does this MR do?
1+
## What does this PR do?
22

3-
<!-- Briefly describe what this MR is about -->
3+
<!-- Briefly describe what this PR is about -->
44

55
## Related issues
66

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net6.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
8+
<IsPackable>false</IsPackable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
13+
<PackageReference Include="MSTest.TestAdapter" Version="3.0.2" />
14+
<PackageReference Include="MSTest.TestFramework" Version="3.0.2" />
15+
<PackageReference Include="coverlet.collector" Version="3.1.2" />
16+
</ItemGroup>
17+
18+
<ItemGroup>
19+
<ProjectReference Include="..\Common.BasicHelper\Common.BasicHelper.csproj" />
20+
</ItemGroup>
21+
22+
</Project>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using Common.BasicHelper.Core.Shell;
2+
3+
namespace Common.BasicHelper.Test;
4+
5+
[TestClass]
6+
public class CommadsExecutor_Test
7+
{
8+
[TestMethod]
9+
public void TestCommand()
10+
{
11+
Console.WriteLine("help".ExecuteAsCommand());
12+
}
13+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace Common.BasicHelper.Test.Core.Shell
8+
{
9+
internal class EnvironmentHelperEnvironmentHelper_Test
10+
{
11+
}
12+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using Common.BasicHelper.UI.Screen;
2+
3+
namespace Common.BasicHelper.Test;
4+
5+
[TestClass]
6+
public class UI_Test
7+
{
8+
[TestMethod]
9+
public void ResolutionSuggestTest()
10+
{
11+
foreach (var item in Resolution.resolutions)
12+
{
13+
Resolution tarRes = Resolution.Suggest(Resolution.Parse("2560x1440"),
14+
Resolution.Parse("1280x720"), item).Integerization();
15+
Console.WriteLine($"{item}\r\n\t{tarRes}");
16+
}
17+
}
18+
}

Common.BasicHelper.Test/Usings.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
global using Microsoft.VisualStudio.TestTools.UnitTesting;
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
using Common.BasicHelper.Util.Extension;
2+
3+
namespace Common.BasicHelper.Test;
4+
5+
[TestClass]
6+
public class Util_Extension_Test
7+
{
8+
[TestMethod]
9+
public void QueueExtensionTest()
10+
{
11+
var queue = new Queue<int>()
12+
.Push(1)
13+
.Push(2)
14+
.Push(3)
15+
.Push(4)
16+
.Push(5)
17+
.Push(6)
18+
.Pop()
19+
;
20+
while (queue.IsNotEmpty())
21+
{
22+
queue = queue.ForEach(x => ++x);
23+
queue = queue.Pop();
24+
}
25+
Assert.AreEqual(0, queue.Count);
26+
}
27+
28+
[TestMethod]
29+
public void DumpQueueTest()
30+
{
31+
var queue = new Queue<int>()
32+
.Push(1)
33+
.Push(2)
34+
.Pop()
35+
.Push(3)
36+
.Push(4)
37+
.Pop()
38+
.Push(5)
39+
;
40+
Assert.AreEqual("3 4 5 ", queue.Dump());
41+
}
42+
}

Common.BasicHelper.Test/Util.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using Common.BasicHelper.Util;
2+
3+
namespace Common.BasicHelper.Test;
4+
5+
[TestClass]
6+
public class Util_Test
7+
{
8+
[TestMethod]
9+
public void GUID_Part_Random_Generate_Test()
10+
{
11+
for (int i = 0; i < 10; i++)
12+
Console.WriteLine(GUID_Helper.Random_GUID_Generate().GetString());
13+
}
14+
}

Common.BasicHelper.sln

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ VisualStudioVersion = 17.1.32407.343
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Common.BasicHelper", "Common.BasicHelper\Common.BasicHelper.csproj", "{A80ED612-3DE2-4106-92C4-96940C93FD1C}"
77
EndProject
8-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTest", "UnitTest\UnitTest.csproj", "{0AC03FB9-0E2A-42FA-B712-685DFE512685}"
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common.BasicHelper.Test", "Common.BasicHelper.Test\Common.BasicHelper.Test.csproj", "{D3DFF9AC-8CF1-42FF-BAF1-954A430DFDCE}"
99
EndProject
1010
Global
1111
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -17,10 +17,10 @@ Global
1717
{A80ED612-3DE2-4106-92C4-96940C93FD1C}.Debug|Any CPU.Build.0 = Debug|Any CPU
1818
{A80ED612-3DE2-4106-92C4-96940C93FD1C}.Release|Any CPU.ActiveCfg = Release|Any CPU
1919
{A80ED612-3DE2-4106-92C4-96940C93FD1C}.Release|Any CPU.Build.0 = Release|Any CPU
20-
{0AC03FB9-0E2A-42FA-B712-685DFE512685}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21-
{0AC03FB9-0E2A-42FA-B712-685DFE512685}.Debug|Any CPU.Build.0 = Debug|Any CPU
22-
{0AC03FB9-0E2A-42FA-B712-685DFE512685}.Release|Any CPU.ActiveCfg = Release|Any CPU
23-
{0AC03FB9-0E2A-42FA-B712-685DFE512685}.Release|Any CPU.Build.0 = Release|Any CPU
20+
{D3DFF9AC-8CF1-42FF-BAF1-954A430DFDCE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{D3DFF9AC-8CF1-42FF-BAF1-954A430DFDCE}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{D3DFF9AC-8CF1-42FF-BAF1-954A430DFDCE}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{D3DFF9AC-8CF1-42FF-BAF1-954A430DFDCE}.Release|Any CPU.Build.0 = Release|Any CPU
2424
EndGlobalSection
2525
GlobalSection(SolutionProperties) = preSolution
2626
HideSolutionNode = FALSE

0 commit comments

Comments
 (0)