77
88namespace Notion . IntegrationTests ;
99
10- public class CommentsClientTests : IDisposable
10+ public class CommentsClientTests : IntegrationTestBase , IDisposable
1111{
12- private readonly INotionClient _client ;
1312 private readonly Page _page ;
1413
1514 public CommentsClientTests ( )
1615 {
17- var options = new ClientOptions { AuthToken = Environment . GetEnvironmentVariable ( "NOTION_AUTH_TOKEN" ) } ;
18-
19- _client = NotionClientFactory . Create ( options ) ;
20-
21- var pageParentId = Environment . GetEnvironmentVariable ( "NOTION_PAGE_PARENT_ID" ) ??
22- throw new InvalidOperationException ( "Page parent id is required." ) ;
23-
24- _page = _client . Pages . CreateAsync (
16+ _page = Client . Pages . CreateAsync (
2517 PagesCreateParametersBuilder . Create (
26- new ParentPageInput { PageId = pageParentId }
18+ new ParentPageInput { PageId = ParentPageId }
2719 ) . Build ( )
2820 ) . Result ;
2921 }
3022
3123 public void Dispose ( )
3224 {
33- _client . Pages . UpdateAsync ( _page . Id , new PagesUpdateParameters { Archived = true } ) . Wait ( ) ;
25+ Client . Pages . UpdateAsync ( _page . Id , new PagesUpdateParameters { Archived = true } ) . Wait ( ) ;
3426 }
3527
3628 [ Fact ]
@@ -43,7 +35,7 @@ public async Task ShouldCreatePageComment()
4335 ) ;
4436
4537 // Act
46- var response = await _client . Comments . CreateAsync ( parameters ) ;
38+ var response = await Client . Comments . CreateAsync ( parameters ) ;
4739
4840 // Arrange
4941
@@ -64,7 +56,7 @@ public async Task ShouldCreatePageComment()
6456 public async Task ShouldCreateADiscussionComment ( )
6557 {
6658 // Arrange
67- var comment = await _client . Comments . CreateAsync (
59+ var comment = await Client . Comments . CreateAsync (
6860 CreateCommentParameters . CreatePageComment (
6961 new ParentPageInput { PageId = _page . Id } ,
7062 new List < RichTextBaseInput >
@@ -75,7 +67,7 @@ public async Task ShouldCreateADiscussionComment()
7567 ) ;
7668
7769 // Act
78- var response = await _client . Comments . CreateAsync (
70+ var response = await Client . Comments . CreateAsync (
7971 CreateCommentParameters . CreateDiscussionComment (
8072 comment . DiscussionId ,
8173 new List < RichTextBaseInput >
0 commit comments