Skip to content

Commit 4c0eafc

Browse files
author
Bart Koelman
committed
Corrected test to detect all fields are retrieved
1 parent 510172b commit 4c0eafc

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Blog.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ public sealed class Blog : Identifiable<int>
1717
[Attr(Capabilities = AttrCapabilities.All & ~(AttrCapabilities.AllowCreate | AttrCapabilities.AllowChange))]
1818
public bool ShowAdvertisements => PlatformName.EndsWith("(using free account)", StringComparison.Ordinal);
1919

20+
public bool IsPublished { get; set; }
21+
2022
[HasMany]
2123
public IList<BlogPost> Posts { get; set; } = new List<BlogPost>();
2224

test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/SparseFieldSets/SparseFieldSetTests.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,7 @@ public async Task Retrieves_all_properties_when_fieldset_contains_readonly_attri
749749
store.Clear();
750750

751751
Blog blog = _fakers.Blog.Generate();
752+
blog.IsPublished = true;
752753

753754
await _testContext.RunOnDatabaseAsync(async dbContext =>
754755
{
@@ -771,7 +772,8 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
771772
responseDocument.Data.SingleValue.Relationships.Should().BeNull();
772773

773774
var blogCaptured = (Blog)store.Resources.Should().ContainSingle(resource => resource is Blog).And.Subject.Single();
774-
blogCaptured.ShowAdvertisements.Should().Be(blogCaptured.ShowAdvertisements);
775+
blogCaptured.ShowAdvertisements.Should().Be(blog.ShowAdvertisements);
776+
blogCaptured.IsPublished.Should().Be(blog.IsPublished);
775777
blogCaptured.Title.Should().Be(blog.Title);
776778
}
777779

@@ -817,7 +819,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
817819
var postCaptured = (BlogPost)store.Resources.Should().ContainSingle(resource => resource is BlogPost).And.Subject.Single();
818820
postCaptured.Id.Should().Be(post.Id);
819821
postCaptured.Caption.Should().Be(post.Caption);
820-
postCaptured.Url.Should().Be(postCaptured.Url);
822+
postCaptured.Url.Should().Be(post.Url);
821823
}
822824

823825
[Fact]

0 commit comments

Comments
 (0)