Skip to content

Commit 25f650f

Browse files
committed
Improving file reading + Adding ability to split configuration into several files
1 parent ec3ac0e commit 25f650f

File tree

17 files changed

+219
-121
lines changed

17 files changed

+219
-121
lines changed

Example/App/App.csproj

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,33 @@
99
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.2.0" />
1010
</ItemGroup>
1111
<ItemGroup>
12-
<None Update="api.cfg.json">
12+
<None Update="api2.cfg.json">
1313
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
1414
</None>
15-
<None Update="DownloadFile.txt">
15+
<None Update="Config\Api\api.cfg.json">
16+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
17+
</None>
18+
<None Update="Config\Api\User\usersApi.cfg.json">
19+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
20+
</None>
21+
<None Update="Config\Api\User\Response\getUserById.json">
1622
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
1723
</None>
1824
</ItemGroup>
1925
<ItemGroup>
2026
<ProjectReference Include="..\..\Src\FakeApi\FakeApi.csproj" />
2127
</ItemGroup>
28+
<ItemGroup>
29+
<Folder Include="Config\" />
30+
<Folder Include="Config\Api\" />
31+
<Folder Include="Config\Api\User\" />
32+
<Folder Include="Config\Api\Order\" />
33+
<Folder Include="Config\Api\User\Response\" />
34+
<Folder Include="Config\Api\Order\Response\" />
35+
</ItemGroup>
36+
<ItemGroup>
37+
<Compile Condition=" '$(EnableDefaultCompileItems)' == 'true' " Update="Program.cs">
38+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
39+
</Compile>
40+
</ItemGroup>
2241
</Project>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"apis": [
3+
{
4+
"url": "https://localhost/api/orders/{orderId}",
5+
"responses": [
6+
{
7+
"active": 1,
8+
"file": "Response/User/getOrderById.json"
9+
},
10+
{
11+
"active": 1,
12+
"method": "PUT",
13+
"file": "Response/User/putOrder.json"
14+
},
15+
{
16+
"active": 1,
17+
"method": "DELETE",
18+
"httpCode": 400,
19+
"customApiException": {
20+
"fullTypeName": "App.CustomWebException, App",
21+
"constructorArgs": [
22+
"Order not found"
23+
]
24+
}
25+
}
26+
]
27+
}
28+
]
29+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"id": 128,
3+
"firstname": "john",
4+
"lastname": "doe"
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"id": 128,
3+
"firstname": "john",
4+
"lastname": "doe"
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"id": 256,
3+
"firstname": "kerry",
4+
"lastname": "king"
5+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"results": [
3+
{
4+
"id": 128,
5+
"firstname": "john",
6+
"lastname": "doe"
7+
},
8+
{
9+
"id": 256,
10+
"firstname": "kerry",
11+
"lastname": "king"
12+
}
13+
]
14+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"results": [
3+
{
4+
"userId": 512,
5+
"firstname": "paul",
6+
"lastname": "mc cartney"
7+
},
8+
{
9+
"id": 1024,
10+
"firstname": "quentin",
11+
"lastname": "tarantino"
12+
}
13+
]
14+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"apis": [
3+
{
4+
"url": "https://localhost/api/users/{userId}",
5+
"responses": [
6+
{
7+
"active": 1,
8+
"file": "Config/Api/User/Response/getUserById.json"
9+
},
10+
{
11+
"active": 1,
12+
"method": "PUT",
13+
"file": "Config/Api/User/Response/putUser.json"
14+
}
15+
]
16+
},
17+
{
18+
"url": "https://localhost/api/users",
19+
"responses": [
20+
{
21+
"active": 1,
22+
"method": "POST",
23+
"file": "Config/Api/User/Response/postUser1.json"
24+
},
25+
{
26+
"active": 0,
27+
"method": "POST",
28+
"file": "Config/Api/User/Response/postUser2.json"
29+
}
30+
]
31+
},
32+
{
33+
"url": "https://localhost/api/users?pIndex={0}&pSize={1}",
34+
"responses": [
35+
{
36+
"active": 1,
37+
"file": "Config/Api/User/Response/searchUsersPage0.json"
38+
},
39+
{
40+
"active": 0,
41+
"file": "Config/Api/User/Response/searchUsersPage1.json"
42+
}
43+
]
44+
}
45+
]
46+
}
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
{
2-
"defaultDelay": 500,
2+
"defaultDelay": 250,
33
"defaultHttpCode": 200,
44
"defaultMethod": "GET",
5+
"apisDirectories": [
6+
"Config/Api/User"
7+
],
58
"apis": [
69
{
710
"url": "http://localhost:8080/api/users/{idUser}",

Example/App/DownloadFile.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)