Skip to content

Commit

Permalink
c18 split assert
Browse files Browse the repository at this point in the history
  • Loading branch information
qdraw committed Oct 18, 2024
1 parent 7dad4bb commit 270faf7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 10 deletions.
8 changes: 5 additions & 3 deletions starsky/starsky.foundation.platform/Helpers/ArgsHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,8 @@ public void NeedHelpShowDialog()
// OpenTelemetry
if ( !string.IsNullOrEmpty(_appSettings.OpenTelemetry?.LogsEndpoint) )
{
_console.WriteLine($"OpenTelemetry LogsEndpoint: {_appSettings.OpenTelemetry.LogsEndpoint} ");
_console.WriteLine(
$"OpenTelemetry LogsEndpoint: {_appSettings.OpenTelemetry.LogsEndpoint} ");
}

if ( !string.IsNullOrEmpty(_appSettings.OpenTelemetry?.MetricsEndpoint) )
Expand All @@ -427,7 +428,8 @@ public void NeedHelpShowDialog()

if ( !string.IsNullOrEmpty(_appSettings.OpenTelemetry?.TracesEndpoint) )
{
_console.WriteLine($"OpenTelemetry TracesEndpoint: {_appSettings.OpenTelemetry.TracesEndpoint} ");
_console.WriteLine(
$"OpenTelemetry TracesEndpoint: {_appSettings.OpenTelemetry.TracesEndpoint} ");
}

_console.Write("SyncIgnore ");
Expand Down Expand Up @@ -804,7 +806,7 @@ public static bool IsSubPathOrPath(IReadOnlyList<string> args)
return false;
}

// Detect if a input is a fullPath or a subPath.
// Detect if an input is a fullPath or a subPath.
for ( var arg = 0; arg < args.Count; arg++ )
{
if ( ( args[arg].Equals("--subpath", StringComparison.CurrentCultureIgnoreCase) ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public void GetPathListFormArgs_CurrentDirectory()
Assert.AreEqual(1, result.Count);
Assert.AreEqual(Directory.GetCurrentDirectory(), result.FirstOrDefault());
}

[TestMethod]
public void GetPathListFormArgs_PathStartsWithDash_CurrentDirectoryReturned()
{
Expand Down Expand Up @@ -229,23 +229,36 @@ public void ArgsHelper_GetSubpathFormArgsTest()
}

[TestMethod]
[ExcludeFromCoverage]
public void ArgsHelper_IfSubPathTest()
public void ArgsHelper_IfSubPathTest1()
{
_appSettings.StorageFolder = new CreateAnImage().BasePath;
var args = new List<string> { "-s", "/" }.ToArray();
Assert.IsTrue(ArgsHelper.IsSubPathOrPath(args));
}

[TestMethod]
public void ArgsHelper_IfSubPathTest2()
{
// Default
args = new List<string> { string.Empty }.ToArray();
var args = new List<string> { string.Empty }.ToArray();
Assert.IsTrue(ArgsHelper.IsSubPathOrPath(args));
}

args = new List<string> { "-p", "/" }.ToArray();
[TestMethod]
public void ArgsHelper_IfSubPathTest3()
{
var args = new List<string> { "-p", "/" }.ToArray();
Assert.IsFalse(ArgsHelper.IsSubPathOrPath(args));
}

[TestMethod]
public void ArgsHelper_IfSubPathTest4()
{
var args = new List<string> { "--path", "/" }.ToArray();
Assert.IsFalse(ArgsHelper.IsSubPathOrPath(args));
}

[TestMethod]
public void ArgsHelper_CurrentDirectory_IfSubpathTest()
public void ArgsHelper_CurrentDirectory_IfSubPathTest()
{
// for selecting the current directory
var args = new List<string> { "-p" }.ToArray();
Expand Down

0 comments on commit 270faf7

Please sign in to comment.