Skip to content

Commit 889fa12

Browse files
Use IAsyncLifetime in PageClient tests
1 parent f6e8feb commit 889fa12

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

Test/Notion.IntegrationTests/PageClientTests.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@
88

99
namespace Notion.IntegrationTests;
1010

11-
public class PageClientTests : IntegrationTestBase, IAsyncDisposable
11+
public class PageClientTests : IntegrationTestBase, IAsyncLifetime
1212
{
13-
private readonly Page _page;
14-
private readonly Database _database;
13+
private Page _page = null!;
14+
private Database _database = null!;
1515

16-
public PageClientTests()
16+
public async Task InitializeAsync()
1717
{
1818
// Create a page
19-
_page = Client.Pages.CreateAsync(
19+
_page = await Client.Pages.CreateAsync(
2020
PagesCreateParametersBuilder.Create(
2121
new ParentPageInput { PageId = ParentPageId }
2222
).Build()
23-
).GetAwaiter().GetResult();
23+
);
2424

2525
// Create a database
2626
var createDbRequest = new DatabasesCreateParameters
@@ -58,10 +58,10 @@ public PageClientTests()
5858
Parent = new ParentPageInput { PageId = _page.Id }
5959
};
6060

61-
_database = Client.Databases.CreateAsync(createDbRequest).GetAwaiter().GetResult();
61+
_database = await Client.Databases.CreateAsync(createDbRequest);
6262
}
6363

64-
public async ValueTask DisposeAsync()
64+
public async Task DisposeAsync()
6565
{
6666
await Client.Pages.UpdateAsync(_page.Id, new PagesUpdateParameters { Archived = true });
6767
}

0 commit comments

Comments
 (0)