Skip to content

Commit cb983b9

Browse files
author
Bart Koelman
committed
Adjusted test names for meta
1 parent c8a6012 commit cb983b9

File tree

5 files changed

+37
-34
lines changed

5 files changed

+37
-34
lines changed

src/Examples/JsonApiDotNetCoreExample/Models/TodoItem.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,6 @@ public class TodoItem : Identifiable, IIsLockable
1515
[Attr]
1616
public long Ordinal { get; set; }
1717

18-
[Attr(Capabilities = AttrCapabilities.All & ~AttrCapabilities.AllowCreate)]
19-
public string AlwaysChangingValue
20-
{
21-
get => Guid.NewGuid().ToString();
22-
set { }
23-
}
24-
2518
[Attr]
2619
public DateTime CreatedDate { get; set; }
2720

test/JsonApiDotNetCoreExampleTests/IntegrationTests/Meta/ResourceMetaTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public ResourceMetaTests(ExampleIntegrationTestContext<Startup, AppDbContext> te
2121
}
2222

2323
[Fact]
24-
public async Task ResourceDefinition_That_Implements_GetMeta_Contains_Resource_Meta()
24+
public async Task Returns_resource_meta_from_ResourceDefinition()
2525
{
2626
// Arrange
2727
var todoItems = new[]
@@ -54,7 +54,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
5454
}
5555

5656
[Fact]
57-
public async Task ResourceDefinition_That_Implements_GetMeta_Contains_Include_Meta()
57+
public async Task Returns_resource_meta_from_ResourceDefinition_in_included_resources()
5858
{
5959
// Arrange
6060
var person = new Person

test/JsonApiDotNetCoreExampleTests/IntegrationTests/Meta/ResponseMetaTests.cs

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System.Collections.Generic;
21
using System.Net;
32
using System.Threading.Tasks;
43
using FluentAssertions;
@@ -31,7 +30,7 @@ public ResponseMetaTests(ExampleIntegrationTestContext<Startup, AppDbContext> te
3130
}
3231

3332
[Fact]
34-
public async Task Registered_IResponseMeta_Adds_TopLevel_Meta()
33+
public async Task Returns_top_level_meta()
3534
{
3635
// Arrange
3736
await _testContext.RunOnDatabaseAsync(async dbContext => { await dbContext.ClearTableAsync<Person>(); });
@@ -63,23 +62,4 @@ public async Task Registered_IResponseMeta_Adds_TopLevel_Meta()
6362
}");
6463
}
6564
}
66-
67-
public sealed class TestResponseMeta : IResponseMeta
68-
{
69-
public IReadOnlyDictionary<string, object> GetMeta()
70-
{
71-
return new Dictionary<string, object>
72-
{
73-
["license"] = "MIT",
74-
["projectUrl"] = "https://github.com/json-api-dotnet/JsonApiDotNetCore/",
75-
["versions"] = new[]
76-
{
77-
"v4.0.0",
78-
"v3.1.0",
79-
"v2.5.2",
80-
"v1.3.1"
81-
}
82-
};
83-
}
84-
}
8565
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using System.Collections.Generic;
2+
using JsonApiDotNetCore.Serialization;
3+
4+
namespace JsonApiDotNetCoreExampleTests.IntegrationTests.Meta
5+
{
6+
public sealed class TestResponseMeta : IResponseMeta
7+
{
8+
public IReadOnlyDictionary<string, object> GetMeta()
9+
{
10+
return new Dictionary<string, object>
11+
{
12+
["license"] = "MIT",
13+
["projectUrl"] = "https://github.com/json-api-dotnet/JsonApiDotNetCore/",
14+
["versions"] = new[]
15+
{
16+
"v4.0.0",
17+
"v3.1.0",
18+
"v2.5.2",
19+
"v1.3.1"
20+
}
21+
};
22+
}
23+
}
24+
}

test/JsonApiDotNetCoreExampleTests/IntegrationTests/Meta/TopLevelCountTests.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Threading.Tasks;
33
using FluentAssertions;
44
using JsonApiDotNetCore.Configuration;
5+
using JsonApiDotNetCore.Resources;
56
using JsonApiDotNetCore.Serialization.Objects;
67
using JsonApiDotNetCoreExample;
78
using JsonApiDotNetCoreExample.Data;
@@ -20,12 +21,17 @@ public TopLevelCountTests(ExampleIntegrationTestContext<Startup, AppDbContext> t
2021
{
2122
_testContext = testContext;
2223

24+
testContext.ConfigureServicesAfterStartup(services =>
25+
{
26+
services.AddScoped(typeof(IResourceChangeTracker<>), typeof(NeverSameResourceChangeTracker<>));
27+
});
28+
2329
var options = (JsonApiOptions) testContext.Factory.Services.GetRequiredService<IJsonApiOptions>();
2430
options.IncludeTotalResourceCount = true;
2531
}
2632

2733
[Fact]
28-
public async Task Total_Resource_Count_Included_For_Collection()
34+
public async Task Renders_resource_count_for_collection()
2935
{
3036
// Arrange
3137
var todoItem = new TodoItem();
@@ -51,7 +57,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
5157
}
5258

5359
[Fact]
54-
public async Task Total_Resource_Count_Included_For_Empty_Collection()
60+
public async Task Renders_resource_count_for_empty_collection()
5561
{
5662
// Arrange
5763
await _testContext.RunOnDatabaseAsync(async dbContext => { await dbContext.ClearTableAsync<TodoItem>(); });
@@ -69,7 +75,7 @@ public async Task Total_Resource_Count_Included_For_Empty_Collection()
6975
}
7076

7177
[Fact]
72-
public async Task Total_Resource_Count_Excluded_From_POST_Response()
78+
public async Task Hides_resource_count_in_create_resource_response()
7379
{
7480
// Arrange
7581
var requestBody = new
@@ -96,7 +102,7 @@ public async Task Total_Resource_Count_Excluded_From_POST_Response()
96102
}
97103

98104
[Fact]
99-
public async Task Total_Resource_Count_Excluded_From_PATCH_Response()
105+
public async Task Hides_resource_count_in_update_resource_response()
100106
{
101107
// Arrange
102108
var todoItem = new TodoItem();

0 commit comments

Comments
 (0)