You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
1.9 KiB
C#
69 lines
1.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
using HttpClientStudy.Core.Utilities;
|
|
|
|
namespace HttpClientStudy.UnitTest.UtilitiesTest
|
|
{
|
|
public class AppUtilityTest
|
|
{
|
|
private readonly ITestOutputHelper _output;
|
|
public AppUtilityTest(ITestOutputHelper testOutput)
|
|
{
|
|
_output = testOutput;
|
|
}
|
|
|
|
[Fact]
|
|
public void ApplicationPaths_Test()
|
|
{
|
|
var dic = AppUtility.GetApplicationPaths();
|
|
|
|
string message = string.Empty;
|
|
foreach (var path in dic)
|
|
{
|
|
message += ($"{path.Key} : {path.Value.path}{Environment.NewLine}");
|
|
}
|
|
|
|
_output.WriteLine(message);
|
|
}
|
|
|
|
[Fact]
|
|
public void RunWebApiExeFile_Test()
|
|
{
|
|
string message = string.Empty;
|
|
|
|
string apiFile = Path.GetFullPath("../../../../Docs/Publish/HttpClientStudy.WebApp/HttpClientStudy.WebApp.exe", Environment.CurrentDirectory);
|
|
|
|
_output.WriteLine($"文件:{apiFile}");
|
|
|
|
message = AppUtility.RunWebApiExeFile(apiFile);
|
|
_output.WriteLine(message);
|
|
}
|
|
|
|
[Fact]
|
|
public void RunWebApiExeFile_StayWindow_Test()
|
|
{
|
|
string message = string.Empty;
|
|
|
|
string apiFile = Path.GetFullPath("../../../../Docs/Publish/HttpClientStudy.WebApp/HttpClientStudy.WebApp.exe", Environment.CurrentDirectory);
|
|
|
|
_output.WriteLine($"文件:{apiFile}");
|
|
|
|
message = AppUtility.RunWebApiExeFile(apiFile,true, "--urls=http://localhost:8644");
|
|
_output.WriteLine(message);
|
|
}
|
|
|
|
[Fact]
|
|
public void Cmd_Test()
|
|
{
|
|
string message = string.Empty;
|
|
message = AppUtility.RunCmd("netstat -ano");
|
|
|
|
_output.WriteLine(message);
|
|
}
|
|
}
|
|
}
|