This commit is contained in:
2020-02-14 00:27:27 +00:00
parent 5ecacb3785
commit acce9f6751
3 changed files with 88 additions and 107 deletions

View File

@@ -118,27 +118,31 @@ same as the server does but in a central location here for all tests to use.
Util.ValidateDataReturnResponseOk(a);
ExcludedWidgetId = a.ObjectResponse["data"]["id"].Value<long>();
//CREATE FILTER
//CREATE LISTVIEW
dynamic dListView = new JArray();
dynamic dfilter = new JArray();
//name starts with filter to constrict to widgets that this test block created only
dynamic DataFilterNameStart = new JObject();
DataFilterNameStart.fld = "widgetname";
DataFilterNameStart.op = Util.OpStartsWith;
DataFilterNameStart.value = WidgetNameStart;
dfilter.Add(DataFilterNameStart);
// dynamic DataFilterNameStart = new JObject();
// DataFilterNameStart.fld = "widgetname";
// DataFilterNameStart.op = Util.OpStartsWith;
// DataFilterNameStart.value = WidgetNameStart;
// dListView.Add(DataFilterNameStart);
dListView.Add(Util.BuildSimpleFilterDataListViewColumn("widgetname", Util.OpStartsWith, WidgetNameStart));
//## INCLUSIVE FILTER
dynamic FilterItem = new JObject();
FilterItem.fld = "widgetstartdate";
FilterItem.op = Util.OpEquality;
FilterItem.value = new DateTime(1968, 3, 12, 10, 0, 0).ToOffsetAdjustedUniversalTime();
dfilter.Add(FilterItem);
// dynamic FilterItem = new JObject();
// FilterItem.fld = "widgetstartdate";
// FilterItem.op = Util.OpEquality;
// FilterItem.value = new DateTime(1968, 3, 12, 10, 0, 0).ToOffsetAdjustedUniversalTime();
// dListView.Add(FilterItem);
dListView.Add(Util.BuildSimpleFilterDataListViewColumn("widgetstartdate", Util.OpEquality, new DateTime(1968, 3, 12, 10, 0, 0).ToOffsetAdjustedUniversalTime()));
//NOW FETCH WIDGET LIST WITH FILTER
a = await Util.PostAsync($"DataList", await Util.GetTokenAsync("manager", "l3tm3in"), Util.BuildDataListRequest(dfilter));
a = await Util.PostAsync($"DataList", await Util.GetTokenAsync("manager", "l3tm3in"), Util.BuildDataListRequestEx(dListView));
Util.ValidateDataReturnResponseOk(a);
Util.ValidateHTTPStatusCode(a, 200);
@@ -215,7 +219,7 @@ same as the server does but in a central location here for all tests to use.
Util.ValidateDataReturnResponseOk(a);
ExcludedWidgetId = a.ObjectResponse["data"]["id"].Value<long>();
//CREATE FILTER
//CREATE LISTVIEW
dynamic dfilter = new JArray();
//name starts with filter to constrict to widgets that this test block created only
@@ -304,7 +308,7 @@ same as the server does but in a central location here for all tests to use.
Util.ValidateDataReturnResponseOk(a);
ExcludedWidgetId = a.ObjectResponse["data"]["id"].Value<long>();
//CREATE FILTER
//CREATE LISTVIEW
dynamic dfilter = new JArray();
@@ -394,7 +398,7 @@ same as the server does but in a central location here for all tests to use.
Util.ValidateDataReturnResponseOk(a);
ExcludedWidgetId = a.ObjectResponse["data"]["id"].Value<long>();
//CREATE FILTER
//CREATE LISTVIEW
dynamic dfilter = new JArray();
//name starts with filter to constrict to widgets that this test block created only
@@ -481,7 +485,7 @@ same as the server does but in a central location here for all tests to use.
Util.ValidateDataReturnResponseOk(a);
ExcludedWidgetId = a.ObjectResponse["data"]["id"].Value<long>();
//CREATE FILTER
//CREATE LISTVIEW
dynamic dfilter = new JArray();
//name starts with filter to constrict to widgets that this test block created only
@@ -567,7 +571,7 @@ same as the server does but in a central location here for all tests to use.
Util.ValidateDataReturnResponseOk(a);
ExcludedWidgetId = a.ObjectResponse["data"]["id"].Value<long>();
//CREATE FILTER
//CREATE LISTVIEW
dynamic dfilter = new JArray();
//name starts with filter to constrict to widgets that this test block created only
@@ -653,7 +657,7 @@ same as the server does but in a central location here for all tests to use.
Util.ValidateDataReturnResponseOk(a);
ExcludedWidgetId = a.ObjectResponse["data"]["id"].Value<long>();
//CREATE FILTER
//CREATE LISTVIEW
dynamic dfilter = new JArray();
@@ -792,7 +796,7 @@ same as the server does but in a central location here for all tests to use.
Util.ValidateDataReturnResponseOk(a);
ExcludedWidgetId = a.ObjectResponse["data"]["id"].Value<long>();
//CREATE FILTER
//CREATE LISTVIEW
dynamic d = new JObject();
d.name = Util.Uniquify(WidgetNameStart);
@@ -927,7 +931,7 @@ same as the server does but in a central location here for all tests to use.
ExclusiveWidgetIdList.Add(a.ObjectResponse["data"]["id"].Value<long>());
//CREATE FILTER
//CREATE LISTVIEW
dynamic dfilter = new JArray();
//name starts with filter to constrict to widgets that this test block created only
@@ -944,7 +948,7 @@ same as the server does but in a central location here for all tests to use.
DataFilterActive.value = "aardvark";
dfilter.Add(DataFilterActive);
//NOW FETCH WIDGET LIST WITH FILTER
a = await Util.PostAsync($"DataList", await Util.GetTokenAsync("manager", "l3tm3in"), Util.BuildDataListRequest(dfilter));
@@ -1038,7 +1042,7 @@ same as the server does but in a central location here for all tests to use.
ExclusiveWidgetIdList.Add(a.ObjectResponse["data"]["id"].Value<long>());
//CREATE FILTER
//CREATE LISTVIEW
dynamic dfilter = new JArray();
//name starts with filter to constrict to widgets that this test block created only
@@ -1145,7 +1149,7 @@ same as the server does but in a central location here for all tests to use.
ExclusiveWidgetIdList.Add(a.ObjectResponse["data"]["id"].Value<long>());
//CREATE FILTER
//CREATE LISTVIEW
dynamic dfilter = new JArray();
//name starts with filter to constrict to widgets that this test block created only
@@ -1254,7 +1258,7 @@ same as the server does but in a central location here for all tests to use.
ExclusiveWidgetIdList.Add(a.ObjectResponse["data"]["id"].Value<long>());
//CREATE FILTER
//CREATE LISTVIEW
dynamic dfilter = new JArray();
//name starts with filter to constrict to widgets that this test block created only
@@ -1361,7 +1365,7 @@ same as the server does but in a central location here for all tests to use.
ExclusiveWidgetIdList.Add(a.ObjectResponse["data"]["id"].Value<long>());
//CREATE FILTER
//CREATE LISTVIEW
dynamic dfilter = new JArray();
//name starts with filter to constrict to widgets that this test block created only
@@ -1469,7 +1473,7 @@ same as the server does but in a central location here for all tests to use.
ExclusiveWidgetIdList.Add(a.ObjectResponse["data"]["id"].Value<long>());
//CREATE FILTER
//CREATE LISTVIEW
dynamic dfilter = new JArray();
//name starts with filter to constrict to widgets that this test block created only
@@ -1576,7 +1580,7 @@ same as the server does but in a central location here for all tests to use.
ExclusiveWidgetIdList.Add(a.ObjectResponse["data"]["id"].Value<long>());
//CREATE FILTER
//CREATE LISTVIEW
dynamic dfilter = new JArray();
//name starts with filter to constrict to widgets that this test block created only
@@ -1683,7 +1687,7 @@ same as the server does but in a central location here for all tests to use.
ExclusiveWidgetIdList.Add(a.ObjectResponse["data"]["id"].Value<long>());
//CREATE FILTER
//CREATE LISTVIEW
dynamic dfilter = new JArray();
//name starts with filter to constrict to widgets that this test block created only
@@ -1790,7 +1794,7 @@ same as the server does but in a central location here for all tests to use.
ExclusiveWidgetIdList.Add(a.ObjectResponse["data"]["id"].Value<long>());
//CREATE FILTER
//CREATE LISTVIEW
dynamic dfilter = new JArray();
//name starts with filter to constrict to widgets that this test block created only
@@ -1896,7 +1900,7 @@ same as the server does but in a central location here for all tests to use.
ExclusiveWidgetIdList.Add(a.ObjectResponse["data"]["id"].Value<long>());
//CREATE FILTER
//CREATE LISTVIEW
dynamic dfilter = new JArray();
//name starts with filter to constrict to widgets that this test block created only
@@ -2002,7 +2006,7 @@ same as the server does but in a central location here for all tests to use.
ExclusiveWidgetIdList.Add(a.ObjectResponse["data"]["id"].Value<long>());
//CREATE FILTER
//CREATE LISTVIEW
dynamic dfilter = new JArray();
//name starts with filter to constrict to widgets that this test block created only
@@ -2107,7 +2111,7 @@ same as the server does but in a central location here for all tests to use.
ExclusiveWidgetIdList.Add(a.ObjectResponse["data"]["id"].Value<long>());
//CREATE FILTER
//CREATE LISTVIEW
dynamic dfilter = new JArray();
//name starts with filter to constrict to widgets that this test block created only
@@ -2215,7 +2219,7 @@ same as the server does but in a central location here for all tests to use.
ExclusiveWidgetIdList.Add(a.ObjectResponse["data"]["id"].Value<long>());
//CREATE FILTER
//CREATE LISTVIEW
dynamic dfilter = new JArray();
//name starts with filter to constrict to widgets that this test block created only
@@ -2232,7 +2236,7 @@ same as the server does but in a central location here for all tests to use.
DataFilterActive.value = "vat";
dfilter.Add(DataFilterActive);
//NOW FETCH WIDGET LIST WITH FILTER
a = await Util.PostAsync($"DataList", await Util.GetTokenAsync("manager", "l3tm3in"), Util.BuildDataListRequest(dfilter));
@@ -2322,7 +2326,7 @@ same as the server does but in a central location here for all tests to use.
Util.ValidateDataReturnResponseOk(a);
ExcludedWidgetId = a.ObjectResponse["data"]["id"].Value<long>();
//CREATE FILTER
//CREATE LISTVIEW
dynamic dfilter = new JArray();
//name starts with filter to constrict to widgets that this test block created only
@@ -2407,7 +2411,7 @@ same as the server does but in a central location here for all tests to use.
ExcludedWidgetId = a.ObjectResponse["data"]["id"].Value<long>();
//CREATE FILTER
//CREATE LISTVIEW
dynamic dfilter = new JArray();
//name starts with filter to constrict to widgets that this test block created only
@@ -2491,7 +2495,7 @@ same as the server does but in a central location here for all tests to use.
ExcludedWidgetId = a.ObjectResponse["data"]["id"].Value<long>();
//CREATE FILTER
//CREATE LISTVIEW
dynamic dfilter = new JArray();
//name starts with filter to constrict to widgets that this test block created only
@@ -2577,7 +2581,7 @@ same as the server does but in a central location here for all tests to use.
ExcludedWidgetId = a.ObjectResponse["data"]["id"].Value<long>();
//CREATE FILTER
//CREATE LISTVIEW
dynamic dfilter = new JArray();
//name starts with filter to constrict to widgets that this test block created only
@@ -2662,7 +2666,7 @@ same as the server does but in a central location here for all tests to use.
ExcludedWidgetId = a.ObjectResponse["data"]["id"].Value<long>();
//CREATE FILTER
//CREATE LISTVIEW
dynamic dfilter = new JArray();
//name starts with filter to constrict to widgets that this test block created only
@@ -2747,7 +2751,7 @@ same as the server does but in a central location here for all tests to use.
ExcludedWidgetId = a.ObjectResponse["data"]["id"].Value<long>();
//CREATE FILTER
//CREATE LISTVIEW
dynamic dfilter = new JArray();
//name starts with filter to constrict to widgets that this test block created only
@@ -2858,7 +2862,7 @@ same as the server does but in a central location here for all tests to use.
NotActiveWidgetIdList.Add(a.ObjectResponse["data"]["id"].Value<long>());
//CREATE FILTER
//CREATE LISTVIEW
dynamic dfilter = new JArray();
//name starts with filter to constrict to widgets that this test block created only
@@ -2972,7 +2976,7 @@ same as the server does but in a central location here for all tests to use.
NotActiveWidgetIdList.Add(a.ObjectResponse["data"]["id"].Value<long>());
//CREATE FILTER
//CREATE LISTVIEW
dynamic dfilter = new JArray();
//name starts with filter to constrict to widgets that this test block created only
@@ -3075,7 +3079,7 @@ same as the server does but in a central location here for all tests to use.
Util.ValidateDataReturnResponseOk(a);
ExcludedWidgetId = a.ObjectResponse["data"]["id"].Value<long>();
//CREATE FILTER
//CREATE LISTVIEW
dynamic dfilter = new JArray();
//name starts with filter to constrict to widgets that this test block created only
@@ -3159,7 +3163,7 @@ same as the server does but in a central location here for all tests to use.
ExcludedWidgetId = a.ObjectResponse["data"]["id"].Value<long>();
//CREATE FILTER
//CREATE LISTVIEW
dynamic dfilter = new JArray();
//name starts with filter to constrict to widgets that this test block created only
@@ -3244,7 +3248,7 @@ same as the server does but in a central location here for all tests to use.
ExcludedWidgetId = a.ObjectResponse["data"]["id"].Value<long>();
//CREATE FILTER
//CREATE LISTVIEW
dynamic dfilter = new JArray();
//name starts with filter to constrict to widgets that this test block created only
@@ -3331,7 +3335,7 @@ same as the server does but in a central location here for all tests to use.
ExcludedWidgetId = a.ObjectResponse["data"]["id"].Value<long>();
//CREATE FILTER
//CREATE LISTVIEW
dynamic dfilter = new JArray();
//name starts with filter to constrict to widgets that this test block created only
@@ -3417,7 +3421,7 @@ same as the server does but in a central location here for all tests to use.
ExcludedWidgetId = a.ObjectResponse["data"]["id"].Value<long>();
//CREATE FILTER
//CREATE LISTVIEW
dynamic dfilter = new JArray();
//name starts with filter to constrict to widgets that this test block created only
@@ -3504,7 +3508,7 @@ same as the server does but in a central location here for all tests to use.
ExcludedWidgetId = a.ObjectResponse["data"]["id"].Value<long>();
//CREATE FILTER
//CREATE LISTVIEW
dynamic dfilter = new JArray();
//name starts with filter to constrict to widgets that this test block created only
@@ -3632,7 +3636,7 @@ same as the server does but in a central location here for all tests to use.
ExclusiveWidgetIdList.Add(a.ObjectResponse["data"]["id"].Value<long>());
//CREATE FILTER
//CREATE LISTVIEW
dynamic dfilter = new JArray();
//name starts with filter to constrict to widgets that this test block created only
@@ -3763,7 +3767,7 @@ same as the server does but in a central location here for all tests to use.
ExclusiveWidgetIdList.Add(a.ObjectResponse["data"]["id"].Value<long>());
//CREATE FILTER
//CREATE LISTVIEW
dynamic dfilter = new JArray();
//name starts with filter to constrict to widgets that this test block created only

View File

@@ -1,44 +0,0 @@
using Xunit;
using Newtonsoft.Json.Linq;
using FluentAssertions;
namespace raven_integration
{
public class DataListMiniVariant
{
/// <summary>
///
/// </summary>
[Fact]
public async void ListShouldFetchAsMiniVersion()
{
ApiResponse a = await Util.PostAsync($"DataList", await Util.GetTokenAsync("manager", "l3tm3in"), Util.BuildDataListRequest(null, null, 3, 0, true));
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
//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

45
util.cs
View File

@@ -586,28 +586,49 @@ namespace raven_integration
return dCustomField.ToString();
}
//// [{fld:"COLUMN UNIQUE KEY ID",sort:"-" or "+",filter:{any:true/false,items:[{FILTER OBJECT SEE BELOW}]} }, {key:"second column unique key"},{...etc...}]
public static object BuildSimpleFilterDataListViewColumn(string fieldKey, string filterOp, object filterValue, string sort = null)
{
dynamic d = new JObject();
d.fld = fieldKey;
if (sort != null)
d.sort = sort;
public static string BuildDataListRequest(dynamic dFilter = null, dynamic dSort = null, int limit = 999, int offset = 0, bool mini = false, string dataListKey = "TestWidgetDataList")
dynamic filter = new JObject();
dynamic items = new JArray();
dynamic fitem = new JObject();
fitem.op = filterOp;
fitem.value = filterValue;
items.Add(fitem);
filter.items = items;
d.filter = filter;
return d;
}
//t(dfilter, dsortarray, 999, 0, false, "UserDataList"));
public static string BuildDataListRequest(object p = null, object o = null, int limit = 999, int offset = 0, bool bWhatever=false, string dataListKey = "TestWidgetDataList")
{
throw new System.NotImplementedException();
}
public static string BuildDataListRequestEx(dynamic dListView = null, int limit = 999, int offset = 0, string dataListKey = "TestWidgetDataList")
{
/*
{
"offset": 0,
"limit": 5,
"mini": false,
"dataListKey": "TestWidgetDataList",
"filterJson": "",
"sortJson": ""
"offset": 0,
"limit": 3,
"dataListKey": "TestWidgetDataList",
"listView": ""
}
*/
dynamic d = new JObject();
d.offset = offset;
d.limit = limit;
d.mini = mini;
d.dataListKey = dataListKey;
if (dFilter != null)
d.filterJson = dFilter.ToString();
if (dSort != null)
d.sortJson = dSort.ToString();
if (dListView != null)
d.dListView = dListView.ToString();
return d.ToString();