Skip to content

Commit c93652d

Browse files
authored
Merge pull request #3 from JSONAPIdotNET/master
#115 #123
2 parents 148563a + 7448fa8 commit c93652d

24 files changed

Lines changed: 763 additions & 132 deletions

JSONAPI.AcceptanceTests.EntityFrameworkTestWebApp.Tests/FetchingResourcesTests.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,23 @@ public async Task Get_related_to_many_included()
116116
}
117117
}
118118

119+
120+
[TestMethod]
121+
[DeploymentItem(@"Data\Comment.csv", @"Data")]
122+
[DeploymentItem(@"Data\Post.csv", @"Data")]
123+
[DeploymentItem(@"Data\PostTagLink.csv", @"Data")]
124+
[DeploymentItem(@"Data\Tag.csv", @"Data")]
125+
[DeploymentItem(@"Data\User.csv", @"Data")]
126+
public async Task Get_related_to_many_included_external()
127+
{
128+
using (var effortConnection = GetEffortConnection())
129+
{
130+
var response = await SubmitGet(effortConnection, "users/401/posts?include=tags");
131+
132+
await AssertResponseContent(response, @"Fixtures\FetchingResources\Get_related_to_many_include_external_response.json", HttpStatusCode.OK);
133+
}
134+
}
135+
119136
[TestMethod]
120137
[DeploymentItem(@"Data\Comment.csv", @"Data")]
121138
[DeploymentItem(@"Data\Post.csv", @"Data")]
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,110 @@
11
{
2-
"data": [
3-
{
4-
"type": "samples",
5-
"id": "1",
6-
"attributes": {
7-
"boolean-field": false,
8-
"byte-field": 0,
9-
"complex-attribute-field": null,
10-
"date-time-field": "0001-01-01T00:00:00",
11-
"date-time-offset-field": "0001-01-01T00:00:00.0000000+00:00",
12-
"decimal-field": "0",
13-
"double-field": 0.0,
14-
"enum-field": 0,
15-
"guid-field": "00000000-0000-0000-0000-000000000000",
16-
"int16-field": 0,
17-
"int32-field": 0,
18-
"int64-field": 0,
19-
"nullable-boolean-field": false,
20-
"nullable-byte-field": null,
21-
"nullable-date-time-field": null,
22-
"nullable-date-time-offset-field": null,
23-
"nullable-decimal-field": null,
24-
"nullable-double-field": null,
25-
"nullable-enum-field": null,
26-
"nullable-guid-field": null,
27-
"nullable-int16-field": null,
28-
"nullable-int32-field": null,
29-
"nullable-int64-field": null,
30-
"nullable-sbyte-field": null,
31-
"nullable-single-field": null,
32-
"nullable-uint16-field": null,
33-
"nullable-uint32-field": null,
34-
"nullable-uint64-field": null,
35-
"sbyte-field": 0,
36-
"single-field": 0.0,
37-
"string-field": null,
38-
"uint16-field": 0,
39-
"uint32-field": 0,
40-
"uint64-field": 0
41-
}
2+
"data": [
3+
{
4+
"type": "samples",
5+
"id": "1",
6+
"attributes": {
7+
"boolean-field": false,
8+
"byte-field": 0,
9+
"complex-attribute-field": null,
10+
"date-time-field": "0001-01-01T00:00:00",
11+
"date-time-offset-field": "0001-01-01T00:00:00.0000000+00:00",
12+
"decimal-field": "0",
13+
"double-field": 0.0,
14+
"enum-field": 0,
15+
"guid-field": "00000000-0000-0000-0000-000000000000",
16+
"int16-field": 0,
17+
"int32-field": 0,
18+
"int64-field": 0,
19+
"j-token-array-field": null,
20+
"j-token-object-field": null,
21+
"j-token-string-field": null,
22+
"nullable-boolean-field": false,
23+
"nullable-byte-field": null,
24+
"nullable-date-time-field": null,
25+
"nullable-date-time-offset-field": null,
26+
"nullable-decimal-field": null,
27+
"nullable-double-field": null,
28+
"nullable-enum-field": null,
29+
"nullable-guid-field": null,
30+
"nullable-int16-field": null,
31+
"nullable-int32-field": null,
32+
"nullable-int64-field": null,
33+
"nullable-sbyte-field": null,
34+
"nullable-single-field": null,
35+
"nullable-uint16-field": null,
36+
"nullable-uint32-field": null,
37+
"nullable-uint64-field": null,
38+
"sbyte-field": 0,
39+
"single-field": 0.0,
40+
"string-field": null,
41+
"uint16-field": 0,
42+
"uint32-field": 0,
43+
"uint64-field": 0
44+
}
45+
},
46+
{
47+
"type": "samples",
48+
"id": "2",
49+
"attributes": {
50+
"boolean-field": true,
51+
"byte-field": 253,
52+
"complex-attribute-field": {
53+
"foo": {
54+
"baz": [ 11 ]
55+
},
56+
"bar": 5
4257
},
43-
{
44-
"type": "samples",
45-
"id": "2",
46-
"attributes": {
47-
"boolean-field": true,
48-
"byte-field": 253,
49-
"complex-attribute-field": {
50-
"foo": {
51-
"baz": [ 11 ]
52-
},
53-
"bar": 5
54-
},
55-
"date-time-field": "1776-07-04T00:00:00",
56-
"date-time-offset-field": "1776-07-04T00:00:00.0000000-05:00",
57-
"decimal-field": "1056789.123",
58-
"double-field": 1056789.123,
59-
"enum-field": 1,
60-
"guid-field": "6566f9b4-5245-40de-890d-98b40a4ad656",
61-
"int16-field": 32000,
62-
"int32-field": 2000000000,
63-
"int64-field": 9223372036854775807,
64-
"nullable-boolean-field": true,
65-
"nullable-byte-field": 253,
66-
"nullable-date-time-field": "1776-07-04T00:00:00",
67-
"nullable-date-time-offset-field": "1776-07-04T00:00:00.0000000-05:00",
68-
"nullable-decimal-field": "1056789.123",
69-
"nullable-double-field": 1056789.123,
70-
"nullable-enum-field": 2,
71-
"nullable-guid-field": "3d1fb81e-43ee-4d04-af91-c8a326341293",
72-
"nullable-int16-field": 32000,
73-
"nullable-int32-field": 2000000000,
74-
"nullable-int64-field": 9223372036854775807,
75-
"nullable-sbyte-field": 123,
76-
"nullable-single-field": 1056789.13,
77-
"nullable-uint16-field": 64000,
78-
"nullable-uint32-field": 3000000000,
79-
"nullable-uint64-field": 9223372036854775808,
80-
"sbyte-field": 123,
81-
"single-field": 1056789.13,
82-
"string-field": "Some string 156",
83-
"uint16-field": 64000,
84-
"uint32-field": 3000000000,
85-
"uint64-field": 9223372036854775808
86-
}
87-
}
88-
]
58+
"date-time-field": "1776-07-04T00:00:00",
59+
"date-time-offset-field": "1776-07-04T00:00:00.0000000-05:00",
60+
"decimal-field": "1056789.123",
61+
"double-field": 1056789.123,
62+
"enum-field": 1,
63+
"guid-field": "6566f9b4-5245-40de-890d-98b40a4ad656",
64+
"int16-field": 32000,
65+
"int32-field": 2000000000,
66+
"int64-field": 9223372036854775807,
67+
"j-token-array-field": [
68+
{
69+
"my-field1": "George Washington",
70+
"overridden-field2": null,
71+
"MyField3": 216
72+
},
73+
{
74+
"my-field1": "Thomas Jefferson",
75+
"overridden-field2": false,
76+
"MyField3": 631
77+
}
78+
],
79+
"j-token-object-field": {
80+
"my-field1": "Abraham Lincoln",
81+
"overridden-field2": true,
82+
"MyField3": 439
83+
},
84+
"j-token-string-field": "Andrew Jackson",
85+
"nullable-boolean-field": true,
86+
"nullable-byte-field": 253,
87+
"nullable-date-time-field": "1776-07-04T00:00:00",
88+
"nullable-date-time-offset-field": "1776-07-04T00:00:00.0000000-05:00",
89+
"nullable-decimal-field": "1056789.123",
90+
"nullable-double-field": 1056789.123,
91+
"nullable-enum-field": 2,
92+
"nullable-guid-field": "3d1fb81e-43ee-4d04-af91-c8a326341293",
93+
"nullable-int16-field": 32000,
94+
"nullable-int32-field": 2000000000,
95+
"nullable-int64-field": 9223372036854775807,
96+
"nullable-sbyte-field": 123,
97+
"nullable-single-field": 1056789.13,
98+
"nullable-uint16-field": 64000,
99+
"nullable-uint32-field": 3000000000,
100+
"nullable-uint64-field": 9223372036854775808,
101+
"sbyte-field": 123,
102+
"single-field": 1056789.13,
103+
"string-field": "Some string 156",
104+
"uint16-field": 64000,
105+
"uint32-field": 3000000000,
106+
"uint64-field": 9223372036854775808
107+
}
108+
}
109+
]
89110
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
{
2+
"data": [
3+
{
4+
"type": "posts",
5+
"id": "201",
6+
"attributes": {
7+
"content": "Post 1 content",
8+
"created": "2015-01-31T14:00:00.0000000+00:00",
9+
"title": "Post 1"
10+
},
11+
"relationships": {
12+
"author": {
13+
"links": {
14+
"self": "https://www.example.com/posts/201/relationships/author",
15+
"related": "https://www.example.com/posts/201/author"
16+
}
17+
},
18+
"comments": {
19+
"links": {
20+
"self": "https://www.example.com/posts/201/relationships/comments",
21+
"related": "https://www.example.com/posts/201/comments"
22+
}
23+
},
24+
"tags": {
25+
"links": {
26+
"self": "https://www.example.com/posts/201/relationships/tags",
27+
"related": "https://www.example.com/posts/201/tags"
28+
},
29+
"data": [
30+
{
31+
"type": "tags",
32+
"id": "301"
33+
},
34+
{
35+
"type": "tags",
36+
"id": "302"
37+
}
38+
]
39+
}
40+
}
41+
},
42+
{
43+
"type": "posts",
44+
"id": "202",
45+
"attributes": {
46+
"content": "Post 2 content",
47+
"created": "2015-02-05T08:10:00.0000000+00:00",
48+
"title": "Post 2"
49+
},
50+
"relationships": {
51+
"author": {
52+
"links": {
53+
"self": "https://www.example.com/posts/202/relationships/author",
54+
"related": "https://www.example.com/posts/202/author"
55+
}
56+
},
57+
"comments": {
58+
"links": {
59+
"self": "https://www.example.com/posts/202/relationships/comments",
60+
"related": "https://www.example.com/posts/202/comments"
61+
}
62+
},
63+
"tags": {
64+
"links": {
65+
"self": "https://www.example.com/posts/202/relationships/tags",
66+
"related": "https://www.example.com/posts/202/tags"
67+
},
68+
"data": [
69+
{
70+
"type": "tags",
71+
"id": "302"
72+
},
73+
{
74+
"type": "tags",
75+
"id": "303"
76+
}
77+
]
78+
}
79+
}
80+
},
81+
{
82+
"type": "posts",
83+
"id": "203",
84+
"attributes": {
85+
"content": "Post 3 content",
86+
"created": "2015-02-07T11:11:00.0000000+00:00",
87+
"title": "Post 3"
88+
},
89+
"relationships": {
90+
"author": {
91+
"links": {
92+
"self": "https://www.example.com/posts/203/relationships/author",
93+
"related": "https://www.example.com/posts/203/author"
94+
}
95+
},
96+
"comments": {
97+
"links": {
98+
"self": "https://www.example.com/posts/203/relationships/comments",
99+
"related": "https://www.example.com/posts/203/comments"
100+
}
101+
},
102+
"tags": {
103+
"links": {
104+
"self": "https://www.example.com/posts/203/relationships/tags",
105+
"related": "https://www.example.com/posts/203/tags"
106+
},
107+
"data": [
108+
{
109+
"type": "tags",
110+
"id": "303"
111+
}
112+
]
113+
}
114+
}
115+
}
116+
],
117+
"included": [
118+
{
119+
"type": "tags",
120+
"id": "301",
121+
"attributes": {
122+
"name": "Tag A"
123+
},
124+
"relationships": {
125+
"posts": {
126+
"links": {
127+
"self": "https://www.example.com/tags/301/relationships/posts",
128+
"related": "https://www.example.com/tags/301/posts"
129+
}
130+
}
131+
}
132+
},
133+
{
134+
"type": "tags",
135+
"id": "302",
136+
"attributes": {
137+
"name": "Tag B"
138+
},
139+
"relationships": {
140+
"posts": {
141+
"links": {
142+
"self": "https://www.example.com/tags/302/relationships/posts",
143+
"related": "https://www.example.com/tags/302/posts"
144+
}
145+
}
146+
}
147+
},
148+
{
149+
"type": "tags",
150+
"id": "303",
151+
"attributes": {
152+
"name": "Tag C"
153+
},
154+
"relationships": {
155+
"posts": {
156+
"links": {
157+
"self": "https://www.example.com/tags/303/relationships/posts",
158+
"related": "https://www.example.com/tags/303/posts"
159+
}
160+
}
161+
}
162+
}
163+
]
164+
}

0 commit comments

Comments
 (0)