Skip to content

Commit f1c0a22

Browse files
User IAsyncLifetime in PageWithPageParent tests
1 parent 889fa12 commit f1c0a22

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

Test/Notion.IntegrationTests/PageWithPageParentTests.cs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
1+
using System.Collections.Generic;
32
using System.Linq;
43
using System.Threading.Tasks;
54
using FluentAssertions;
@@ -8,11 +7,11 @@
87

98
namespace Notion.IntegrationTests;
109

11-
public class PageWithPageParentTests : IntegrationTestBase, IAsyncDisposable
10+
public class PageWithPageParentTests : IntegrationTestBase, IAsyncLifetime
1211
{
13-
private readonly Page _page;
12+
private Page _page = null!;
1413

15-
public PageWithPageParentTests()
14+
public async Task InitializeAsync()
1615
{
1716
var pagesCreateParameters = PagesCreateParametersBuilder
1817
.Create(new ParentPageInput() { PageId = ParentPageId })
@@ -25,7 +24,12 @@ public PageWithPageParentTests()
2524
}
2625
}).Build();
2726

28-
_page = Client.Pages.CreateAsync(pagesCreateParameters).GetAwaiter().GetResult();
27+
_page = await Client.Pages.CreateAsync(pagesCreateParameters);
28+
}
29+
30+
public async Task DisposeAsync()
31+
{
32+
await Client.Pages.UpdateAsync(_page.Id, new PagesUpdateParameters { Archived = true });
2933
}
3034

3135
[Fact]
@@ -63,9 +67,4 @@ public async Task Update_Title_Of_Page()
6367

6468
titleProperty.Results.First().As<TitlePropertyItem>().Title.PlainText.Should().Be("Page Title Updated");
6569
}
66-
67-
public async ValueTask DisposeAsync()
68-
{
69-
await Client.Pages.UpdateAsync(_page.Id, new PagesUpdateParameters { Archived = true });
70-
}
7170
}

0 commit comments

Comments
 (0)