Skip to content

Commit 35aa804

Browse files
Add unit tests
1 parent 2fd80ab commit 35aa804

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

Test/Notion.UnitTests/FileUploadsClientTests.cs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,4 +178,45 @@ public async Task SendAsync_CallsRestClientPostAsync_WithCorrectParameters()
178178
Assert.Equal(expectedResponse.Id, response.Id);
179179
_restClientMock.VerifyAll();
180180
}
181+
182+
#region ListAsync Tests
183+
184+
[Fact]
185+
public async Task ListAsync_CallsRestClientGetAsync_WithCorrectParameters()
186+
{
187+
// Arrange
188+
var request = new ListFileUploadsRequest
189+
{
190+
PageSize = 10,
191+
StartCursor = "cursor123",
192+
Status = "completed"
193+
};
194+
195+
_restClientMock
196+
.Setup(client => client.GetAsync<ListFileUploadsResponse>(
197+
It.Is<string>(url => url == ApiEndpoints.FileUploadsApiUrls.List),
198+
It.IsAny<IDictionary<string, string>>(),
199+
null,
200+
null,
201+
It.IsAny<CancellationToken>()
202+
))
203+
.ReturnsAsync(new ListFileUploadsResponse
204+
{
205+
Results = new List<FileObjectResponse>
206+
{
207+
new() { Id = "file1", Status = "completed" },
208+
new() { Id = "file2", Status = "completed" }
209+
}
210+
});
211+
212+
// Act
213+
var response = await _fileUploadClient.ListAsync(request);
214+
215+
// Assert
216+
Assert.NotNull(response);
217+
Assert.Equal(2, response.Results.Count);
218+
_restClientMock.VerifyAll();
219+
}
220+
221+
#endregion ListAsync Tests
181222
}

0 commit comments

Comments
 (0)