-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathUserComponentTests.cs
More file actions
executable file
·57 lines (52 loc) · 1.94 KB
/
UserComponentTests.cs
File metadata and controls
executable file
·57 lines (52 loc) · 1.94 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
53
54
55
56
57
using System.Collections.Generic;
using System.Threading.Tasks;
using ConfIT;
using ConfIT.Extension;
using ConfIT.Util;
using Newtonsoft.Json.Linq;
using User.ComponentTests.SetUp;
using Xunit;
using Xunit.Abstractions;
namespace User.ComponentTests
{
public class UserComponentTests : BaseTest, IClassFixture<TestSuiteFixture>
{
public UserComponentTests(TestSuiteFixture fixture, ITestOutputHelper output)
: base(
fixture.TestHttpClient,
fixture.SuiteConfig,
fixture.TestProcessFactory,
new TestOutputLogger(output),
fixture.Filter)
{
}
/// <summary>
/// Entry point for testApi. We can run testApi in two ways
/// TO run by files, we can add
/// --> [MemberData(nameof(GetTestCases), "user.json")]
/// --> [MemberData(nameof(GetTestCases), "errors.json")]
/// TO run tests by folder, we can add
/// --> [MemberData(nameof(GetTestCasesForFolder))]
/// </summary>
/// <param name="testName"></param>
/// <param name="test"></param>
/// <param name="mocks"></param>
[Theory]
[MemberData(nameof(GetTestCasesForFolder), "TestCase")]
public async Task ExecuteTest(string testName, JToken test) =>
await Execute(testName, test.ToTestCase(null, null));
/// <summary>
/// Use this to read tests from a single file
/// </summary>
/// <param name="fileName"></param>
/// <returns></returns>
public static IEnumerable<object[]> GetTestCases(string fileName) =>
TestReader.GetTestsForAFile("TestCase", fileName);
/// <summary>
/// Use this to read tests from a folder
/// </summary>
/// <returns></returns>
public static IEnumerable<object[]> GetTestCasesForFolder(string folder) =>
TestReader.GetTestsForAFolder(folder);
}
}