Skip to content

Commit e5f9eb2

Browse files
author
Chris Santero
committed
Refactor configuration and document materialization systems
1 parent 91ca6a3 commit e5f9eb2

File tree

119 files changed

+3081
-2081
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+3081
-2081
lines changed

JSONAPI.AcceptanceTests.EntityFrameworkTestWebApp.Tests/AcceptanceTestsBase.cs

+5-6
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
using System.Text.RegularExpressions;
77
using System.Threading.Tasks;
88
using FluentAssertions;
9-
using JSONAPI.EntityFramework.Tests.TestWebApp;
10-
using JSONAPI.EntityFramework.Tests.TestWebApp.Models;
9+
using JSONAPI.AcceptanceTests.EntityFrameworkTestWebApp.Models;
1110
using JSONAPI.Json;
1211
using Microsoft.Owin.Testing;
1312
using Microsoft.VisualStudio.TestTools.UnitTesting;
@@ -58,7 +57,7 @@ protected async Task<HttpResponseMessage> SubmitGet(DbConnection effortConnectio
5857
{
5958
using (var server = TestServer.Create(app =>
6059
{
61-
var startup = new Startup(context => new TestDbContext(effortConnection, false));
60+
var startup = new Startup(() => new TestDbContext(effortConnection, false));
6261
startup.Configuration(app);
6362
}))
6463
{
@@ -75,7 +74,7 @@ protected async Task<HttpResponseMessage> SubmitPost(DbConnection effortConnecti
7574
{
7675
using (var server = TestServer.Create(app =>
7776
{
78-
var startup = new Startup(context => new TestDbContext(effortConnection, false));
77+
var startup = new Startup(() => new TestDbContext(effortConnection, false));
7978
startup.Configuration(app);
8079
}))
8180
{
@@ -100,7 +99,7 @@ protected async Task<HttpResponseMessage> SubmitPatch(DbConnection effortConnect
10099
{
101100
using (var server = TestServer.Create(app =>
102101
{
103-
var startup = new Startup(context => new TestDbContext(effortConnection, false));
102+
var startup = new Startup(() => new TestDbContext(effortConnection, false));
104103
startup.Configuration(app);
105104
}))
106105
{
@@ -124,7 +123,7 @@ protected async Task<HttpResponseMessage> SubmitDelete(DbConnection effortConnec
124123
{
125124
using (var server = TestServer.Create(app =>
126125
{
127-
var startup = new Startup(context => new TestDbContext(effortConnection, false));
126+
var startup = new Startup(() => new TestDbContext(effortConnection, false));
128127
startup.Configuration(app);
129128
}))
130129
{

JSONAPI.AcceptanceTests.EntityFrameworkTestWebApp.Tests/CreatingResourcesTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using System.Net;
44
using System.Threading.Tasks;
55
using FluentAssertions;
6-
using JSONAPI.EntityFramework.Tests.TestWebApp.Models;
6+
using JSONAPI.AcceptanceTests.EntityFrameworkTestWebApp.Models;
77
using Microsoft.VisualStudio.TestTools.UnitTesting;
88

99
namespace JSONAPI.AcceptanceTests.EntityFrameworkTestWebApp.Tests
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
OfficerId,Name,Rank
2+
"12000","James T. Kirk","Captain"
3+
"12010","Jean-Luc Picard","Captain"
4+
"12011","William T. Riker","Commander"
5+
"12012","Data","Lt. Commander"
6+
"12013","Deanna Troi","Lt. Commander"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
StarshipId,Name,StarshipClassId
2+
"NCC-1701","USS Enterprise","80001"
3+
"NCC-1701-D","USS Enterprise","80002"
4+
"NCC-74656","USS Voyager","80003"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
StarshipClassId,Name
2+
"80001","Constitution"
3+
"80002","Galaxy"
4+
"80003","Intrepid"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
StarshipId,OfficerId,Position
2+
"NCC-1701","12000","Commanding Officer"
3+
"NCC-1701-D","12010","Commanding Officer"
4+
"NCC-1701-D","12011","First Officer"
5+
"NCC-1701-D","12012","Second Officer"
6+
"NCC-1701-D","12013","Ship's Counselor"

JSONAPI.AcceptanceTests.EntityFrameworkTestWebApp.Tests/DeletingResourcesTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using System.Net;
33
using System.Threading.Tasks;
44
using FluentAssertions;
5-
using JSONAPI.EntityFramework.Tests.TestWebApp.Models;
5+
using JSONAPI.AcceptanceTests.EntityFrameworkTestWebApp.Models;
66
using Microsoft.VisualStudio.TestTools.UnitTesting;
77

88
namespace JSONAPI.AcceptanceTests.EntityFrameworkTestWebApp.Tests

JSONAPI.AcceptanceTests.EntityFrameworkTestWebApp.Tests/Fixtures/FetchingResources/Get_related_resource_for_relationship_that_doesnt_exist.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"id": "{{SOME_GUID}}",
55
"status": "404",
66
"title": "Resource not found",
7-
"detail": "No relationship `bananas` exists for the resource with type `posts` and id `201`."
7+
"detail": "No relationship `bananas` exists for the resource type `posts`."
88
}
99
]
1010
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{
2+
"data": [
3+
{
4+
"type": "starships",
5+
"id": "NCC-1701",
6+
"attributes": {
7+
"name": "USS Enterprise",
8+
"starship-class": "Constitution"
9+
},
10+
"relationships": {
11+
"officers": {
12+
"links": {
13+
"self": "https://www.example.com/starships/NCC-1701/relationships/officers",
14+
"related": "https://www.example.com/starships/NCC-1701/officers"
15+
}
16+
},
17+
"ship-counselor": {
18+
"links": {
19+
"self": "https://www.example.com/starships/NCC-1701/relationships/ship-counselor",
20+
"related": "https://www.example.com/starships/NCC-1701/ship-counselor"
21+
}
22+
}
23+
}
24+
},
25+
{
26+
"type": "starships",
27+
"id": "NCC-1701-D",
28+
"attributes": {
29+
"name": "USS Enterprise",
30+
"starship-class": "Galaxy"
31+
},
32+
"relationships": {
33+
"officers": {
34+
"links": {
35+
"self": "https://www.example.com/starships/NCC-1701-D/relationships/officers",
36+
"related": "https://www.example.com/starships/NCC-1701-D/officers"
37+
}
38+
},
39+
"ship-counselor": {
40+
"links": {
41+
"self": "https://www.example.com/starships/NCC-1701-D/relationships/ship-counselor",
42+
"related": "https://www.example.com/starships/NCC-1701-D/ship-counselor"
43+
}
44+
}
45+
}
46+
},
47+
{
48+
"type": "starships",
49+
"id": "NCC-74656",
50+
"attributes": {
51+
"name": "USS Voyager",
52+
"starship-class": "Intrepid"
53+
},
54+
"relationships": {
55+
"officers": {
56+
"links": {
57+
"self": "https://www.example.com/starships/NCC-74656/relationships/officers",
58+
"related": "https://www.example.com/starships/NCC-74656/officers"
59+
}
60+
},
61+
"ship-counselor": {
62+
"links": {
63+
"self": "https://www.example.com/starships/NCC-74656/relationships/ship-counselor",
64+
"related": "https://www.example.com/starships/NCC-74656/ship-counselor"
65+
}
66+
}
67+
}
68+
}
69+
]
70+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"data": {
3+
"type": "starships",
4+
"id": "NCC-1701",
5+
"attributes": {
6+
"name": "USS Enterprise",
7+
"starship-class": "Constitution"
8+
},
9+
"relationships": {
10+
"officers": {
11+
"links": {
12+
"self": "https://www.example.com/starships/NCC-1701/relationships/officers",
13+
"related": "https://www.example.com/starships/NCC-1701/officers"
14+
}
15+
},
16+
"ship-counselor": {
17+
"links": {
18+
"self": "https://www.example.com/starships/NCC-1701/relationships/ship-counselor",
19+
"related": "https://www.example.com/starships/NCC-1701/ship-counselor"
20+
}
21+
}
22+
}
23+
}
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{
2+
"data": [
3+
{
4+
"type": "starship-officers",
5+
"id": "NCC-1701-D_12010",
6+
"attributes": {
7+
"name": "Jean-Luc Picard",
8+
"position": "Commanding Officer",
9+
"rank": "Captain"
10+
},
11+
"relationships": {
12+
"current-ship": {
13+
"links": {
14+
"self": "https://www.example.com/starship-officers/NCC-1701-D_12010/relationships/current-ship",
15+
"related": "https://www.example.com/starship-officers/NCC-1701-D_12010/current-ship"
16+
}
17+
}
18+
}
19+
},
20+
{
21+
"type": "starship-officers",
22+
"id": "NCC-1701-D_12011",
23+
"attributes": {
24+
"name": "William T. Riker",
25+
"position": "First Officer",
26+
"rank": "Commander"
27+
},
28+
"relationships": {
29+
"current-ship": {
30+
"links": {
31+
"self": "https://www.example.com/starship-officers/NCC-1701-D_12011/relationships/current-ship",
32+
"related": "https://www.example.com/starship-officers/NCC-1701-D_12011/current-ship"
33+
}
34+
}
35+
}
36+
},
37+
{
38+
"type": "starship-officers",
39+
"id": "NCC-1701-D_12012",
40+
"attributes": {
41+
"name": "Data",
42+
"position": "Second Officer",
43+
"rank": "Lt. Commander"
44+
},
45+
"relationships": {
46+
"current-ship": {
47+
"links": {
48+
"self": "https://www.example.com/starship-officers/NCC-1701-D_12012/relationships/current-ship",
49+
"related": "https://www.example.com/starship-officers/NCC-1701-D_12012/current-ship"
50+
}
51+
}
52+
}
53+
},
54+
{
55+
"type": "starship-officers",
56+
"id": "NCC-1701-D_12013",
57+
"attributes": {
58+
"name": "Deanna Troi",
59+
"position": "Ship's Counselor",
60+
"rank": "Lt. Commander"
61+
},
62+
"relationships": {
63+
"current-ship": {
64+
"links": {
65+
"self": "https://www.example.com/starship-officers/NCC-1701-D_12013/relationships/current-ship",
66+
"related": "https://www.example.com/starship-officers/NCC-1701-D_12013/current-ship"
67+
}
68+
}
69+
}
70+
}
71+
]
72+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"data": {
3+
"type": "starship-officers",
4+
"id": "NCC-1701-D_12013",
5+
"attributes": {
6+
"name": "Deanna Troi",
7+
"position": "Ship's Counselor",
8+
"rank": "Lt. Commander"
9+
},
10+
"relationships": {
11+
"current-ship": {
12+
"links": {
13+
"self": "https://www.example.com/starship-officers/NCC-1701-D_12013/relationships/current-ship",
14+
"related": "https://www.example.com/starship-officers/NCC-1701-D_12013/current-ship"
15+
}
16+
}
17+
}
18+
}
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"errors": [
3+
{
4+
"id": "{{SOME_GUID}}",
5+
"status": "404",
6+
"title": "Resource not found",
7+
"detail": "No record exists with type `starships` and ID `NCC-asdf`."
8+
}
9+
]
10+
}

JSONAPI.AcceptanceTests.EntityFrameworkTestWebApp.Tests/HeterogeneousTests.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ namespace JSONAPI.AcceptanceTests.EntityFrameworkTestWebApp.Tests
88
public class HeterogeneousTests : AcceptanceTestsBase
99
{
1010
[TestMethod]
11-
[DeploymentItem(@"Data\Comment.csv", @"Acceptance\Data")]
12-
[DeploymentItem(@"Data\Post.csv", @"Acceptance\Data")]
13-
[DeploymentItem(@"Data\PostTagLink.csv", @"Acceptance\Data")]
14-
[DeploymentItem(@"Data\Tag.csv", @"Acceptance\Data")]
15-
[DeploymentItem(@"Data\User.csv", @"Acceptance\Data")]
11+
[DeploymentItem(@"Data\Comment.csv", @"Data")]
12+
[DeploymentItem(@"Data\Post.csv", @"Data")]
13+
[DeploymentItem(@"Data\PostTagLink.csv", @"Data")]
14+
[DeploymentItem(@"Data\Tag.csv", @"Data")]
15+
[DeploymentItem(@"Data\User.csv", @"Data")]
1616
public async Task Get()
1717
{
1818
using (var effortConnection = GetEffortConnection())

JSONAPI.AcceptanceTests.EntityFrameworkTestWebApp.Tests/JSONAPI.AcceptanceTests.EntityFrameworkTestWebApp.Tests.csproj

+18
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
<Compile Include="ErrorsTests.cs" />
9797
<Compile Include="FetchingResourcesTests.cs" />
9898
<Compile Include="HeterogeneousTests.cs" />
99+
<Compile Include="MappedTests.cs" />
99100
<Compile Include="Properties\AssemblyInfo.cs" />
100101
<Compile Include="SortingTests.cs" />
101102
<Compile Include="TestHelpers.cs" />
@@ -122,6 +123,18 @@
122123
<EmbeddedResource Include="Fixtures\CreatingResources\Responses\Post_with_client_provided_id_Response.json" />
123124
<EmbeddedResource Include="Fixtures\CreatingResources\Responses\Post_with_empty_id_Response.json" />
124125
<None Include="App.config" />
126+
<None Include="Data\Officer.csv">
127+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
128+
</None>
129+
<None Include="Data\StarshipOfficerLink.csv">
130+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
131+
</None>
132+
<None Include="Data\StarshipClass.csv">
133+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
134+
</None>
135+
<None Include="Data\Starship.csv">
136+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
137+
</None>
125138
<None Include="Data\Building.csv">
126139
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
127140
</None>
@@ -215,6 +228,11 @@
215228
<EmbeddedResource Include="Fixtures\UpdatingResources\Responses\PatchWithToOneLinkageObjectMissingIdResponse.json" />
216229
<EmbeddedResource Include="Fixtures\UpdatingResources\Responses\PatchWithToOneLinkageObjectMissingTypeResponse.json" />
217230
<EmbeddedResource Include="Fixtures\UpdatingResources\Responses\PatchWithToOneUpdateResponse.json" />
231+
<EmbeddedResource Include="Fixtures\Mapped\Responses\Get_all.json" />
232+
<EmbeddedResource Include="Fixtures\Mapped\Responses\Get_by_id.json" />
233+
<EmbeddedResource Include="Fixtures\Mapped\Responses\Get_resource_by_id_that_doesnt_exist.json" />
234+
<EmbeddedResource Include="Fixtures\Mapped\Responses\Get_related_to_one_response.json" />
235+
<EmbeddedResource Include="Fixtures\Mapped\Responses\Get_related_to_many_response.json" />
218236
<None Include="packages.config" />
219237
</ItemGroup>
220238
<Choose>

0 commit comments

Comments
 (0)