Untitled
unknown
csharp
2 years ago
1.0 kB
8
Indexable
[Fact]
public async Task TestSomething()
{
using (var db = new DB())
{
string membersFirstname = "Zondra";
//...write the query/queries here; keep in mind that only SELECT queries are valid...
var response = await db.Authors
.Join(db.Books,
author => author.Id,
book => book.Author.Id,
(Author, book) => new { Author, Book = book })
.Join(db.Loans,
combined => combined.Book.Id,
loan => loan.Book.Id,
(combined, loan) => new { combined.Author, combined.Book, Loan = loan })
.Join(db.Members,
combined => combined.Loan.Member.Id,
member => member.Id,
(combined, Member) => new { combined.Author, combined.Book, combined.Loan, Member })
.Where(result => result.Member.Firstname == membersFirstname)
.Select(result => result.Author.Firstname)
.FirstOrDefaultAsync();
//...add assertions to test the results or run of query/queries here...
Assert.Equal("Zulema", response);
}
}Editor is loading...
Leave a Comment