-
-
Notifications
You must be signed in to change notification settings - Fork 484
Expand file tree
/
Copy pathGetFeaturesTests.cs
More file actions
52 lines (45 loc) · 2.25 KB
/
Copy pathGetFeaturesTests.cs
File metadata and controls
52 lines (45 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using System;
using NUnit.Framework;
using PuppeteerSharp.Nunit;
namespace PuppeteerSharp.Tests.ChromeLauncherTests
{
public class GetFeaturesTests : PuppeteerPageBaseTest
{
[Test, PuppeteerTest("ChromeLauncher.test.ts", "getFeatures", "returns an empty array when no options are provided")]
public void ReturnsAnEmptyArrayWhenNoOptionsAreProvided()
{
var result = ChromeLauncher.GetFeatures("--foo", Array.Empty<string>());
Assert.That(result, Is.Empty);
}
[Test, PuppeteerTest("ChromeLauncher.test.ts", "getFeatures", "returns an empty array when no options match the flag")]
public void ReturnsAnEmptyArrayWhenNoOptionsMatchTheFlag()
{
var result = ChromeLauncher.GetFeatures("--foo", new[] { "--bar", "--baz" });
Assert.That(result, Is.Empty);
}
[Test, PuppeteerTest("ChromeLauncher.test.ts", "getFeatures", "returns an array of values when options match the flag")]
public void ReturnsAnArrayOfValuesWhenOptionsMatchTheFlag()
{
var result = ChromeLauncher.GetFeatures("--foo", new[] { "--foo=bar", "--foo=baz" });
Assert.That(result, Is.EqualTo(new[] { "bar", "baz" }));
}
[Test, PuppeteerTest("ChromeLauncher.test.ts", "getFeatures", "does not handle whitespace")]
public void DoesNotHandleWhitespace()
{
var result = ChromeLauncher.GetFeatures("--foo", new[] { "--foo bar", "--foo baz " });
Assert.That(result, Is.Empty);
}
[Test, PuppeteerTest("ChromeLauncher.test.ts", "getFeatures", "handles equals sign around the flag and value")]
public void HandlesEqualsSignAroundTheFlagAndValue()
{
var result = ChromeLauncher.GetFeatures("--foo", new[] { "--foo=bar", "--foo=baz" });
Assert.That(result, Is.EqualTo(new[] { "bar", "baz" }));
}
[Test, PuppeteerTest("ChromeLauncher.test.ts", "getFeatures", "handles comma-separated values")]
public void HandlesCommaSeparatedValues()
{
var result = ChromeLauncher.GetFeatures("--foo", new[] { "--foo=bar,baz", "--foo=qux" });
Assert.That(result, Is.EqualTo(new[] { "bar", "baz", "qux" }));
}
}
}