This commit is contained in:
48
DataList/Paging.cs
Normal file
48
DataList/Paging.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using Xunit;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using FluentAssertions;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Concurrent;
|
||||
|
||||
namespace raven_integration
|
||||
{
|
||||
|
||||
public class DataListPaging
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Paging test
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void PagingShouldWorkAsExpected()
|
||||
{
|
||||
//Get all
|
||||
ApiResponse a = await Util.GetAsync("Widget/listwidgets?Offset=2&Limit=3", await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
Util.ValidateHTTPStatusCode(a, 200);
|
||||
|
||||
//assert aAll contains at least two records
|
||||
((JArray)a.ObjectResponse["data"]).Count.Should().Be(3);
|
||||
|
||||
JObject jp = (JObject)a.ObjectResponse["paging"];
|
||||
jp["count"].Value<long>().Should().BeGreaterThan(5);
|
||||
jp["offset"].Value<int>().Should().Be(2);
|
||||
jp["limit"].Value<int>().Should().Be(3);
|
||||
jp["first"].Value<string>().Should().EndWith("&pageSize=3");
|
||||
jp["previous"].Value<string>().Should().EndWith("&pageSize=3");
|
||||
jp["next"].Value<string>().Should().EndWith("&pageSize=3");
|
||||
jp["last"].Value<string>().Should().EndWith("&pageSize=3");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//==================================================
|
||||
|
||||
}//eoc
|
||||
}//eons
|
||||
Reference in New Issue
Block a user