-
-
Notifications
You must be signed in to change notification settings - Fork 454
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
168 additions
and
41 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
lib/PuppeteerSharp.Tests/ChromeLauncherTests/GetFeaturesTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System; | ||
using PuppeteerSharp.Nunit; | ||
using NUnit.Framework; | ||
|
||
namespace PuppeteerSharp.Tests.ChromeLauncherTests | ||
{ | ||
public class GetFeaturesTests : PuppeteerPageBaseTest | ||
{ | ||
|
||
[PuppeteerTest("ChromeLauncher.test.ts", "getFeatures", "returns an empty array when no options are provided")] | ||
public void ReturnsAnEmptyArrayWhenNoOptionsAreProvided() | ||
{ | ||
var result = ChromiumLauncher.GetFeatures("--foo", Array.Empty<string>()); | ||
Assert.IsEmpty(result); | ||
} | ||
|
||
[PuppeteerTest("ChromeLauncher.test.ts", "getFeatures", "returns an empty array when no options match the flag")] | ||
public void ReturnsAnEmptyArrayWhenNoOptionsMatchTheFlag() | ||
{ | ||
var result = ChromiumLauncher.GetFeatures("--foo", new[] { "--bar", "--baz" }); | ||
Assert.IsEmpty(result); | ||
} | ||
|
||
[PuppeteerTest("ChromeLauncher.test.ts", "getFeatures", "returns an array of values when options match the flag")] | ||
public void ReturnsAnArrayOfValuesWhenOptionsMatchTheFlag() | ||
{ | ||
var result = ChromiumLauncher.GetFeatures("--foo", new[] { "--foo=bar", "--foo=baz" }); | ||
Assert.AreEqual(new[] { "bar", "baz" }, result); | ||
} | ||
|
||
[PuppeteerTest("ChromeLauncher.test.ts", "getFeatures", "does not handle whitespace")] | ||
public void DoesNotHandleWhitespace() | ||
{ | ||
var result = ChromiumLauncher.GetFeatures("--foo", new[] { "--foo bar", "--foo baz " }); | ||
Assert.IsEmpty(result); | ||
} | ||
|
||
[PuppeteerTest("ChromeLauncher.test.ts", "getFeatures", "handles equals sign around the flag and value")] | ||
public void HandlesEqualsSignAroundTheFlagAndValue() | ||
{ | ||
var result = ChromiumLauncher.GetFeatures("--foo", new[] { "--foo=bar", "--foo=baz" }); | ||
Assert.AreEqual(new[] { "bar", "baz" }, result); | ||
} | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
lib/PuppeteerSharp.Tests/ChromeLauncherTests/RemoveMatchingFlagsTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System; | ||
using PuppeteerSharp.Nunit; | ||
using NUnit.Framework; | ||
|
||
namespace PuppeteerSharp.Tests.ChromeLauncherTests | ||
{ | ||
public class RemoveMatchingFlagsTests : PuppeteerPageBaseTest | ||
{ | ||
|
||
[PuppeteerTest("ChromeLauncher.test.ts", "removeMatchingFlags", "empty")] | ||
public void Empty() | ||
{ | ||
var a = Array.Empty<string>(); | ||
var result = ChromiumLauncher.RemoveMatchingFlags(a, "--foo"); | ||
Assert.IsEmpty(result); | ||
} | ||
|
||
[PuppeteerTest("ChromeLauncher.test.ts", "removeMatchingFlags", "with one match")] | ||
public void WithOneMatch() | ||
{ | ||
var a = new[] { "--foo=1", "--bar=baz" }; | ||
var result = ChromiumLauncher.RemoveMatchingFlags(a, "--foo"); | ||
Assert.AreEqual(new[] { "--bar=baz" }, result); | ||
} | ||
|
||
[PuppeteerTest("ChromeLauncher.test.ts", "removeMatchingFlags", "with multiple matches")] | ||
public void WithMultipleMatches() | ||
{ | ||
var a = new[] { "--foo=1", "--bar=baz", "--foo=2" }; | ||
var result = ChromiumLauncher.RemoveMatchingFlags(a, "--foo"); | ||
Assert.AreEqual(new[] { "--bar=baz" }, result); | ||
} | ||
|
||
[PuppeteerTest("ChromeLauncher.test.ts", "removeMatchingFlags", "with no matches")] | ||
public void WithNoMatches() | ||
{ | ||
var a = new[] { "--foo=1", "--bar=baz" }; | ||
var result = ChromiumLauncher.RemoveMatchingFlags(a, "--baz"); | ||
Assert.AreEqual(new[] { "--foo=1", "--bar=baz" }, result); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters