using Xunit; using Newtonsoft.Json.Linq; using FluentAssertions; namespace raven_integration { public class DataListMiniVariant { /// /// /// [Fact] public async void ListShouldFetchAsMiniVersion() { //Get without rights /* "{\"data\":[ [{\"v\":1},{\"v\":\"Handcrafted Concrete Chicken 76\",\"i\":1},{\"v\":1}], [{\"v\":2},{\"v\":\"Fantastic Cotton Chicken 77\",\"i\":2},{\"v\":2}], [{\"v\":3},{\"v\":\"Generic Concrete Ball 78\",\"i\":3},{\"v\":3}] ], \"paging\":{\"count\":513,\"offset\":0,\"limit\":3,\"first\":\"http://localhost:7575/api/v8/DataList/List?pageNo=1&pageSize=3\",\"previous\":null,\"next\":\"http://localhost:7575/api/v8/DataList/List?pageNo=1&pageSize=3\",\"last\":\"http://localhost:7575/api/v8/DataList/List?pageNo=171&pageSize=3\"}, \"columns\":\"[ {\\\"cm\\\":\\\"df\\\",\\\"dt\\\":0,\\\"ay\\\":2}, {\\\"cm\\\":\\\"Widget\\\",\\\"dt\\\":4,\\\"ay\\\":2} ]\"}" */ ApiResponse a = await Util.GetAsync("DataList/list?DataListKey=TestWidgetDataList&Offset=0&Limit=3&Mini=true", await Util.GetTokenAsync("manager", "l3tm3in")); Util.ValidateDataReturnResponseOk(a); //Assert the data array //Data array should contain 3 arrays var rows = ((JArray)a.ObjectResponse["data"]); rows.Count.Should().Be(3); //each array inside data array should have three objects foreach (JArray row in rows) { row.Count.Should().Be(3); } //assert the columns array BUG BUG, it's a string, not an array of json but a string value of json!? //the columns property should define two columns and the first should be df and the second should be Widget dt4 var columns = ((JArray)a.ObjectResponse["columns"]); columns.Count.Should().Be(2); } //================================================== }//eoc }//eons