36 lines
1.1 KiB
C#
36 lines
1.1 KiB
C#
using Microsoft.Extensions.Logging.Abstractions;
|
|
using Piwigo.Client.Contract;
|
|
|
|
namespace Piwigo.Client.Tests;
|
|
|
|
[TestFixture]
|
|
public class ImageApiTests : ApiTestsBase
|
|
{
|
|
private IImageApi _imageApi = null!;
|
|
|
|
protected override void OnSetUp()
|
|
{
|
|
base.OnSetUp();
|
|
_imageApi = new ImageApi(Context, new NullLogger<ImageApi>());
|
|
}
|
|
|
|
[Test]
|
|
public async Task GetImages_should_return_expected_images()
|
|
{
|
|
await SetJsonResultFromFileAsync("ImageApi.getImages.json");
|
|
|
|
var result = await _imageApi.GetImages(7, true, new PagingInfo(0, 100, 0), ImageFilter.Empty);
|
|
|
|
CorrectMethodShouldGetCalled("pwg.categories.getImages");
|
|
CorrectParamShouldGetSent("cat_id", "7");
|
|
CorrectParamShouldGetSent("recursive", "true");
|
|
CorrectParamShouldGetSent("per_page", "100");
|
|
CorrectParamShouldGetSent("page", "0");
|
|
|
|
result.Images.Should().HaveCount(4);
|
|
result.Images.First().Id.Should().Be(4);
|
|
result.Paging.Page.Should().Be(0);
|
|
result.Paging.PageSize.Should().Be(100);
|
|
result.Paging.TotalItems.Should().Be(4);
|
|
}
|
|
} |