collection resolver progress
This commit is contained in:
@@ -588,10 +588,8 @@ TEST_CASE_METHOD(QueryFixture, "Test load entity with eager has many relation",
|
||||
}
|
||||
|
||||
TEST_CASE_METHOD(QueryFixture, "Test load entity with lazy has many relation", "[query][has_many][lazy]") {
|
||||
// auto result = repo.attach<author>("authors")
|
||||
// .and_then( [this] { return repo.attach<book>("books"); } )
|
||||
auto result = repo.attach<book>("books")
|
||||
.and_then( [this] { return repo.attach<author>("authors"); } )
|
||||
auto result = repo.attach<author>("authors")
|
||||
.and_then( [this] { return repo.attach<book>("books"); } )
|
||||
.and_then([this] {
|
||||
return repo.create(db);
|
||||
} );
|
||||
@@ -662,6 +660,13 @@ TEST_CASE_METHOD(QueryFixture, "Test load entity with lazy has many relation", "
|
||||
REQUIRE(a->year_of_birth == authors.at(index)->year_of_birth);
|
||||
REQUIRE(a->distinguished == authors.at(index)->distinguished);
|
||||
REQUIRE(!a->books.empty());
|
||||
for (const auto& b : a->books) {
|
||||
const auto title = b->title;
|
||||
// REQUIRE(b->id == books.at(index)->id);
|
||||
// REQUIRE(b->title == books.at(index)->title);
|
||||
// REQUIRE(b->author_id == books.at(index)->author_id);
|
||||
// REQUIRE(b->published_in == books.at(index)->published_in);
|
||||
}
|
||||
++index;
|
||||
}
|
||||
}
|
||||
@@ -735,11 +740,12 @@ TEST_CASE_METHOD(QueryFixture, "Test load entity with lazy belongs to relation",
|
||||
}
|
||||
|
||||
TEST_CASE_METHOD(QueryFixture, "Test load entity with eager belongs to relation", "[query][belongs_to][eager]") {
|
||||
auto result = repo.attach<author>("authors")
|
||||
.and_then( [this] { return repo.attach<book>("books"); } )
|
||||
.and_then([this] {
|
||||
return repo.create(db);
|
||||
} );
|
||||
// auto result = repo.attach<author>("authors")
|
||||
// .and_then( [this] { return repo.attach<book>("books"); } )
|
||||
auto result = repo.attach<book>("books")
|
||||
.and_then( [this] { return repo.attach<author>("authors"); })
|
||||
.and_then([this] { return repo.create(db); });
|
||||
REQUIRE(result.is_ok());
|
||||
|
||||
const std::vector authors {
|
||||
object_ptr{std::make_shared<author>(1, "Michael", "Crichton", "23.10.1942", 1975, true)},
|
||||
|
||||
Reference in New Issue
Block a user