Skip to content

Commit 3f71a74

Browse files
MaxTube-dotadmin
andauthored
Issues 152 (#161) +semver:skip
* Issues 152 Read all files from the Samples folder, no need to add the folder to the test manually. * Issues 152 Read all files from the Samples folder, no need to add the folder to the test manually. * Issues 152 Change class name. --------- Co-authored-by: admin <[email protected]>
1 parent b99703f commit 3f71a74

File tree

1 file changed

+11
-39
lines changed

1 file changed

+11
-39
lines changed

tests/HydraScript.IntegrationTests/SuccessfulProgramsTests.cs

Lines changed: 11 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,51 +4,23 @@ namespace HydraScript.IntegrationTests;
44

55
public class SuccessfulProgramsTests(TestHostFixture fixture) : IClassFixture<TestHostFixture>
66
{
7-
[Theory, MemberData(nameof(SuccessfulProgramsNames))]
8-
public void Invoke_NoError_ReturnCodeIsZero(string fileName)
7+
[Theory]
8+
[ClassData(typeof(SuccessfulPrograms))]
9+
public void Invoke_NoError_ReturnCodeIsZero(string relativePathToFile)
910
{
1011
var runner = fixture.GetRunner(
1112
new TestHostFixture.Options(
12-
FileName: $"Samples/{fileName}",
13+
FileName: relativePathToFile,
1314
MockFileSystem: false));
1415
var code = runner.Invoke();
1516
code.Should().Be(Executor.ExitCodes.Success);
1617
}
1718

18-
public static TheoryData<string> SuccessfulProgramsNames =>
19-
new(
20-
[
21-
"abs.js",
22-
"arraddremove.js",
23-
"arreditread.js",
24-
"ceil.js",
25-
"cycled.js",
26-
"defaultarray.js",
27-
"equals.js",
28-
"exprtest.js",
29-
"fastpow.js",
30-
"forwardref.js",
31-
"gcd.js",
32-
"lcm.js",
33-
"linkedlist.js",
34-
"objeditread.js",
35-
"overload.js",
36-
"overload_object.js",
37-
"posneg.js",
38-
"prime.js",
39-
"primefactor.js",
40-
"quicksort.js",
41-
"range.js",
42-
"recur.js",
43-
"scope.js",
44-
"searchinll.js",
45-
"settable.js",
46-
"squareroot.js",
47-
"summator.js",
48-
"tern.js",
49-
"this.js",
50-
"typeresolving.js",
51-
"vec2d.js",
52-
"xxx.js"
53-
]);
19+
public class SuccessfulPrograms : TheoryData<string>
20+
{
21+
public SuccessfulPrograms()
22+
{
23+
AddRange(Directory.GetFiles("Samples"));
24+
}
25+
}
5426
}

0 commit comments

Comments
 (0)