This commit is contained in:
@@ -3031,6 +3031,464 @@ namespace raven_integration
|
|||||||
Util.ValidateHTTPStatusCode(a, 204);
|
Util.ValidateHTTPStatusCode(a, 204);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public async void DateTokenQ1LastYearFilterWorks()
|
||||||
|
{
|
||||||
|
|
||||||
|
var WidgetNameStart = "DateTokenQ1LastYearFilterWorks";
|
||||||
|
|
||||||
|
long IncludedWidgetId = 0;
|
||||||
|
long ExcludedWidgetId = 0;
|
||||||
|
|
||||||
|
//BUILD DATES FOR THIS TEST
|
||||||
|
|
||||||
|
DateTime InclusiveStartDate;
|
||||||
|
DateTime ExclusiveStartDate;
|
||||||
|
|
||||||
|
//##################################################################################
|
||||||
|
var FilterToken = TokenQ1LastYear;
|
||||||
|
InclusiveStartDate = new DateTime(DateTime.Now.Year - 1, 1, 1, 00, 5, 00).ToUniversalTime();
|
||||||
|
ExclusiveStartDate = new DateTime(DateTime.Now.Year - 1, 4, 1, 00, 5, 00).ToUniversalTime();
|
||||||
|
//##################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
DateTime InclusiveEndDate = InclusiveStartDate.AddHours(1);
|
||||||
|
DateTime ExclusiveEndDate = ExclusiveStartDate.AddHours(1);
|
||||||
|
|
||||||
|
//CREATE TEST WIDGETS
|
||||||
|
//included widget
|
||||||
|
dynamic w = new JObject();
|
||||||
|
w.name = Util.Uniquify(WidgetNameStart);
|
||||||
|
w.startDate = InclusiveStartDate;
|
||||||
|
w.endDate = InclusiveEndDate;
|
||||||
|
|
||||||
|
|
||||||
|
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), w.ToString());
|
||||||
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
|
IncludedWidgetId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||||
|
|
||||||
|
//Excluded widget
|
||||||
|
w.name = Util.Uniquify(WidgetNameStart);
|
||||||
|
w.startDate = ExclusiveStartDate;
|
||||||
|
w.endDate = ExclusiveEndDate;
|
||||||
|
|
||||||
|
a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), w.ToString());
|
||||||
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
|
ExcludedWidgetId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||||
|
|
||||||
|
//CREATE FILTER
|
||||||
|
dynamic d = new JObject();
|
||||||
|
d.name = Util.Uniquify(WidgetNameStart);
|
||||||
|
// d.ownerId = 1L;
|
||||||
|
d["public"] = true;
|
||||||
|
d.listKey = "widget";
|
||||||
|
|
||||||
|
dynamic dfilter = new JArray();
|
||||||
|
|
||||||
|
//name starts with filter to constrict to widgets that this test block created only
|
||||||
|
dynamic DataFilterNameStart = new JObject();
|
||||||
|
DataFilterNameStart.fld = "name";
|
||||||
|
DataFilterNameStart.op = OpStartsWith;
|
||||||
|
DataFilterNameStart.value = WidgetNameStart;
|
||||||
|
dfilter.Add(DataFilterNameStart);
|
||||||
|
|
||||||
|
//## INCLUSIVE FILTER
|
||||||
|
dynamic FilterItem = new JObject();
|
||||||
|
FilterItem.fld = "startdate";
|
||||||
|
FilterItem.op = OpEquality;
|
||||||
|
FilterItem.value = FilterToken;
|
||||||
|
dfilter.Add(FilterItem);
|
||||||
|
|
||||||
|
d.filter = dfilter.ToString();//it expects it to be a json string, not actual json
|
||||||
|
|
||||||
|
a = await Util.PostAsync("DataFilter", await Util.GetTokenAsync("BizAdminFull"), d.ToString());
|
||||||
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
|
|
||||||
|
long DataFilterId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||||
|
|
||||||
|
//NOW FETCH WIDGET LIST WITH FILTER
|
||||||
|
a = await Util.GetAsync($"Widget/listwidgets?Offset=0&Limit=999&DataFilterId={DataFilterId.ToString()}", await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||||
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
|
Util.ValidateHTTPStatusCode(a, 200);
|
||||||
|
|
||||||
|
//assert contains at least this test record
|
||||||
|
((JArray)a.ObjectResponse["data"]).Count.Should().BeGreaterThan(0);
|
||||||
|
var v = ((JArray)a.ObjectResponse["data"]);
|
||||||
|
List<long> IDInResultList = new List<long>();
|
||||||
|
int InclusiveMatchCount = 0;
|
||||||
|
int ExclusiveMatchCount = 0;
|
||||||
|
foreach (JObject o in v)
|
||||||
|
{
|
||||||
|
if (IncludedWidgetId == o["id"].Value<long>())
|
||||||
|
InclusiveMatchCount++;
|
||||||
|
if (ExcludedWidgetId == o["id"].Value<long>())//whups
|
||||||
|
ExclusiveMatchCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
InclusiveMatchCount.Should().BeGreaterOrEqualTo(1);
|
||||||
|
ExclusiveMatchCount.Should().Be(0);
|
||||||
|
|
||||||
|
//DELETE WIDGETS
|
||||||
|
a = await Util.DeleteAsync("Widget/" + IncludedWidgetId.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
||||||
|
Util.ValidateHTTPStatusCode(a, 204);
|
||||||
|
|
||||||
|
a = await Util.DeleteAsync("Widget/" + ExcludedWidgetId.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
||||||
|
Util.ValidateHTTPStatusCode(a, 204);
|
||||||
|
|
||||||
|
|
||||||
|
//DELETE DATAFILTER
|
||||||
|
a = await Util.DeleteAsync("DataFilter/" + DataFilterId.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
||||||
|
Util.ValidateHTTPStatusCode(a, 204);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public async void DateTokenQ2LastYearFilterWorks()
|
||||||
|
{
|
||||||
|
|
||||||
|
var WidgetNameStart = "DateTokenQ2LastYearFilterWorks";
|
||||||
|
|
||||||
|
long IncludedWidgetId = 0;
|
||||||
|
long ExcludedWidgetId = 0;
|
||||||
|
|
||||||
|
//BUILD DATES FOR THIS TEST
|
||||||
|
|
||||||
|
DateTime InclusiveStartDate;
|
||||||
|
DateTime ExclusiveStartDate;
|
||||||
|
|
||||||
|
//##################################################################################
|
||||||
|
var FilterToken = TokenQ2LastYear;
|
||||||
|
InclusiveStartDate = new DateTime(DateTime.Now.Year - 1, 4, 1, 00, 5, 00).ToUniversalTime();
|
||||||
|
ExclusiveStartDate = new DateTime(DateTime.Now.Year - 1, 1, 1, 00, 5, 00).ToUniversalTime();
|
||||||
|
//##################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
DateTime InclusiveEndDate = InclusiveStartDate.AddHours(1);
|
||||||
|
DateTime ExclusiveEndDate = ExclusiveStartDate.AddHours(1);
|
||||||
|
|
||||||
|
//CREATE TEST WIDGETS
|
||||||
|
//included widget
|
||||||
|
dynamic w = new JObject();
|
||||||
|
w.name = Util.Uniquify(WidgetNameStart);
|
||||||
|
w.startDate = InclusiveStartDate;
|
||||||
|
w.endDate = InclusiveEndDate;
|
||||||
|
|
||||||
|
|
||||||
|
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), w.ToString());
|
||||||
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
|
IncludedWidgetId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||||
|
|
||||||
|
//Excluded widget
|
||||||
|
w.name = Util.Uniquify(WidgetNameStart);
|
||||||
|
w.startDate = ExclusiveStartDate;
|
||||||
|
w.endDate = ExclusiveEndDate;
|
||||||
|
|
||||||
|
a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), w.ToString());
|
||||||
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
|
ExcludedWidgetId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||||
|
|
||||||
|
//CREATE FILTER
|
||||||
|
dynamic d = new JObject();
|
||||||
|
d.name = Util.Uniquify(WidgetNameStart);
|
||||||
|
// d.ownerId = 1L;
|
||||||
|
d["public"] = true;
|
||||||
|
d.listKey = "widget";
|
||||||
|
|
||||||
|
dynamic dfilter = new JArray();
|
||||||
|
|
||||||
|
//name starts with filter to constrict to widgets that this test block created only
|
||||||
|
dynamic DataFilterNameStart = new JObject();
|
||||||
|
DataFilterNameStart.fld = "name";
|
||||||
|
DataFilterNameStart.op = OpStartsWith;
|
||||||
|
DataFilterNameStart.value = WidgetNameStart;
|
||||||
|
dfilter.Add(DataFilterNameStart);
|
||||||
|
|
||||||
|
//## INCLUSIVE FILTER
|
||||||
|
dynamic FilterItem = new JObject();
|
||||||
|
FilterItem.fld = "startdate";
|
||||||
|
FilterItem.op = OpEquality;
|
||||||
|
FilterItem.value = FilterToken;
|
||||||
|
dfilter.Add(FilterItem);
|
||||||
|
|
||||||
|
d.filter = dfilter.ToString();//it expects it to be a json string, not actual json
|
||||||
|
|
||||||
|
a = await Util.PostAsync("DataFilter", await Util.GetTokenAsync("BizAdminFull"), d.ToString());
|
||||||
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
|
|
||||||
|
long DataFilterId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||||
|
|
||||||
|
//NOW FETCH WIDGET LIST WITH FILTER
|
||||||
|
a = await Util.GetAsync($"Widget/listwidgets?Offset=0&Limit=999&DataFilterId={DataFilterId.ToString()}", await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||||
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
|
Util.ValidateHTTPStatusCode(a, 200);
|
||||||
|
|
||||||
|
//assert contains at least this test record
|
||||||
|
((JArray)a.ObjectResponse["data"]).Count.Should().BeGreaterThan(0);
|
||||||
|
var v = ((JArray)a.ObjectResponse["data"]);
|
||||||
|
List<long> IDInResultList = new List<long>();
|
||||||
|
int InclusiveMatchCount = 0;
|
||||||
|
int ExclusiveMatchCount = 0;
|
||||||
|
foreach (JObject o in v)
|
||||||
|
{
|
||||||
|
if (IncludedWidgetId == o["id"].Value<long>())
|
||||||
|
InclusiveMatchCount++;
|
||||||
|
if (ExcludedWidgetId == o["id"].Value<long>())//whups
|
||||||
|
ExclusiveMatchCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
InclusiveMatchCount.Should().BeGreaterOrEqualTo(1);
|
||||||
|
ExclusiveMatchCount.Should().Be(0);
|
||||||
|
|
||||||
|
//DELETE WIDGETS
|
||||||
|
a = await Util.DeleteAsync("Widget/" + IncludedWidgetId.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
||||||
|
Util.ValidateHTTPStatusCode(a, 204);
|
||||||
|
|
||||||
|
a = await Util.DeleteAsync("Widget/" + ExcludedWidgetId.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
||||||
|
Util.ValidateHTTPStatusCode(a, 204);
|
||||||
|
|
||||||
|
|
||||||
|
//DELETE DATAFILTER
|
||||||
|
a = await Util.DeleteAsync("DataFilter/" + DataFilterId.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
||||||
|
Util.ValidateHTTPStatusCode(a, 204);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public async void DateTokenQ3LastYearFilterWorks()
|
||||||
|
{
|
||||||
|
|
||||||
|
var WidgetNameStart = "DateTokenQ3LastYearFilterWorks";
|
||||||
|
|
||||||
|
long IncludedWidgetId = 0;
|
||||||
|
long ExcludedWidgetId = 0;
|
||||||
|
|
||||||
|
//BUILD DATES FOR THIS TEST
|
||||||
|
|
||||||
|
DateTime InclusiveStartDate;
|
||||||
|
DateTime ExclusiveStartDate;
|
||||||
|
|
||||||
|
//##################################################################################
|
||||||
|
var FilterToken = TokenQ3LastYear;
|
||||||
|
InclusiveStartDate = new DateTime(DateTime.Now.Year - 1, 7, 1, 00, 5, 00).ToUniversalTime();
|
||||||
|
ExclusiveStartDate = new DateTime(DateTime.Now.Year - 1, 4, 1, 00, 5, 00).ToUniversalTime();
|
||||||
|
//##################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
DateTime InclusiveEndDate = InclusiveStartDate.AddHours(1);
|
||||||
|
DateTime ExclusiveEndDate = ExclusiveStartDate.AddHours(1);
|
||||||
|
|
||||||
|
//CREATE TEST WIDGETS
|
||||||
|
//included widget
|
||||||
|
dynamic w = new JObject();
|
||||||
|
w.name = Util.Uniquify(WidgetNameStart);
|
||||||
|
w.startDate = InclusiveStartDate;
|
||||||
|
w.endDate = InclusiveEndDate;
|
||||||
|
|
||||||
|
|
||||||
|
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), w.ToString());
|
||||||
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
|
IncludedWidgetId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||||
|
|
||||||
|
//Excluded widget
|
||||||
|
w.name = Util.Uniquify(WidgetNameStart);
|
||||||
|
w.startDate = ExclusiveStartDate;
|
||||||
|
w.endDate = ExclusiveEndDate;
|
||||||
|
|
||||||
|
a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), w.ToString());
|
||||||
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
|
ExcludedWidgetId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||||
|
|
||||||
|
//CREATE FILTER
|
||||||
|
dynamic d = new JObject();
|
||||||
|
d.name = Util.Uniquify(WidgetNameStart);
|
||||||
|
// d.ownerId = 1L;
|
||||||
|
d["public"] = true;
|
||||||
|
d.listKey = "widget";
|
||||||
|
|
||||||
|
dynamic dfilter = new JArray();
|
||||||
|
|
||||||
|
//name starts with filter to constrict to widgets that this test block created only
|
||||||
|
dynamic DataFilterNameStart = new JObject();
|
||||||
|
DataFilterNameStart.fld = "name";
|
||||||
|
DataFilterNameStart.op = OpStartsWith;
|
||||||
|
DataFilterNameStart.value = WidgetNameStart;
|
||||||
|
dfilter.Add(DataFilterNameStart);
|
||||||
|
|
||||||
|
//## INCLUSIVE FILTER
|
||||||
|
dynamic FilterItem = new JObject();
|
||||||
|
FilterItem.fld = "startdate";
|
||||||
|
FilterItem.op = OpEquality;
|
||||||
|
FilterItem.value = FilterToken;
|
||||||
|
dfilter.Add(FilterItem);
|
||||||
|
|
||||||
|
d.filter = dfilter.ToString();//it expects it to be a json string, not actual json
|
||||||
|
|
||||||
|
a = await Util.PostAsync("DataFilter", await Util.GetTokenAsync("BizAdminFull"), d.ToString());
|
||||||
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
|
|
||||||
|
long DataFilterId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||||
|
|
||||||
|
//NOW FETCH WIDGET LIST WITH FILTER
|
||||||
|
a = await Util.GetAsync($"Widget/listwidgets?Offset=0&Limit=999&DataFilterId={DataFilterId.ToString()}", await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||||
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
|
Util.ValidateHTTPStatusCode(a, 200);
|
||||||
|
|
||||||
|
//assert contains at least this test record
|
||||||
|
((JArray)a.ObjectResponse["data"]).Count.Should().BeGreaterThan(0);
|
||||||
|
var v = ((JArray)a.ObjectResponse["data"]);
|
||||||
|
List<long> IDInResultList = new List<long>();
|
||||||
|
int InclusiveMatchCount = 0;
|
||||||
|
int ExclusiveMatchCount = 0;
|
||||||
|
foreach (JObject o in v)
|
||||||
|
{
|
||||||
|
if (IncludedWidgetId == o["id"].Value<long>())
|
||||||
|
InclusiveMatchCount++;
|
||||||
|
if (ExcludedWidgetId == o["id"].Value<long>())//whups
|
||||||
|
ExclusiveMatchCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
InclusiveMatchCount.Should().BeGreaterOrEqualTo(1);
|
||||||
|
ExclusiveMatchCount.Should().Be(0);
|
||||||
|
|
||||||
|
//DELETE WIDGETS
|
||||||
|
a = await Util.DeleteAsync("Widget/" + IncludedWidgetId.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
||||||
|
Util.ValidateHTTPStatusCode(a, 204);
|
||||||
|
|
||||||
|
a = await Util.DeleteAsync("Widget/" + ExcludedWidgetId.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
||||||
|
Util.ValidateHTTPStatusCode(a, 204);
|
||||||
|
|
||||||
|
|
||||||
|
//DELETE DATAFILTER
|
||||||
|
a = await Util.DeleteAsync("DataFilter/" + DataFilterId.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
||||||
|
Util.ValidateHTTPStatusCode(a, 204);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public async void DateTokenQ4LastYearFilterWorks()
|
||||||
|
{
|
||||||
|
|
||||||
|
var WidgetNameStart = "DateTokenQ4LastYearFilterWorks";
|
||||||
|
|
||||||
|
long IncludedWidgetId = 0;
|
||||||
|
long ExcludedWidgetId = 0;
|
||||||
|
|
||||||
|
//BUILD DATES FOR THIS TEST
|
||||||
|
|
||||||
|
DateTime InclusiveStartDate;
|
||||||
|
DateTime ExclusiveStartDate;
|
||||||
|
|
||||||
|
//##################################################################################
|
||||||
|
var FilterToken = TokenQ4LastYear;
|
||||||
|
InclusiveStartDate = new DateTime(DateTime.Now.Year - 1, 10, 1, 00, 5, 00).ToUniversalTime();
|
||||||
|
ExclusiveStartDate = new DateTime(DateTime.Now.Year - 1, 7, 1, 00, 5, 00).ToUniversalTime();
|
||||||
|
//##################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
DateTime InclusiveEndDate = InclusiveStartDate.AddHours(1);
|
||||||
|
DateTime ExclusiveEndDate = ExclusiveStartDate.AddHours(1);
|
||||||
|
|
||||||
|
//CREATE TEST WIDGETS
|
||||||
|
//included widget
|
||||||
|
dynamic w = new JObject();
|
||||||
|
w.name = Util.Uniquify(WidgetNameStart);
|
||||||
|
w.startDate = InclusiveStartDate;
|
||||||
|
w.endDate = InclusiveEndDate;
|
||||||
|
|
||||||
|
|
||||||
|
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), w.ToString());
|
||||||
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
|
IncludedWidgetId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||||
|
|
||||||
|
//Excluded widget
|
||||||
|
w.name = Util.Uniquify(WidgetNameStart);
|
||||||
|
w.startDate = ExclusiveStartDate;
|
||||||
|
w.endDate = ExclusiveEndDate;
|
||||||
|
|
||||||
|
a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), w.ToString());
|
||||||
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
|
ExcludedWidgetId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||||
|
|
||||||
|
//CREATE FILTER
|
||||||
|
dynamic d = new JObject();
|
||||||
|
d.name = Util.Uniquify(WidgetNameStart);
|
||||||
|
// d.ownerId = 1L;
|
||||||
|
d["public"] = true;
|
||||||
|
d.listKey = "widget";
|
||||||
|
|
||||||
|
dynamic dfilter = new JArray();
|
||||||
|
|
||||||
|
//name starts with filter to constrict to widgets that this test block created only
|
||||||
|
dynamic DataFilterNameStart = new JObject();
|
||||||
|
DataFilterNameStart.fld = "name";
|
||||||
|
DataFilterNameStart.op = OpStartsWith;
|
||||||
|
DataFilterNameStart.value = WidgetNameStart;
|
||||||
|
dfilter.Add(DataFilterNameStart);
|
||||||
|
|
||||||
|
//## INCLUSIVE FILTER
|
||||||
|
dynamic FilterItem = new JObject();
|
||||||
|
FilterItem.fld = "startdate";
|
||||||
|
FilterItem.op = OpEquality;
|
||||||
|
FilterItem.value = FilterToken;
|
||||||
|
dfilter.Add(FilterItem);
|
||||||
|
|
||||||
|
d.filter = dfilter.ToString();//it expects it to be a json string, not actual json
|
||||||
|
|
||||||
|
a = await Util.PostAsync("DataFilter", await Util.GetTokenAsync("BizAdminFull"), d.ToString());
|
||||||
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
|
|
||||||
|
long DataFilterId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||||
|
|
||||||
|
//NOW FETCH WIDGET LIST WITH FILTER
|
||||||
|
a = await Util.GetAsync($"Widget/listwidgets?Offset=0&Limit=999&DataFilterId={DataFilterId.ToString()}", await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||||
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
|
Util.ValidateHTTPStatusCode(a, 200);
|
||||||
|
|
||||||
|
//assert contains at least this test record
|
||||||
|
((JArray)a.ObjectResponse["data"]).Count.Should().BeGreaterThan(0);
|
||||||
|
var v = ((JArray)a.ObjectResponse["data"]);
|
||||||
|
List<long> IDInResultList = new List<long>();
|
||||||
|
int InclusiveMatchCount = 0;
|
||||||
|
int ExclusiveMatchCount = 0;
|
||||||
|
foreach (JObject o in v)
|
||||||
|
{
|
||||||
|
if (IncludedWidgetId == o["id"].Value<long>())
|
||||||
|
InclusiveMatchCount++;
|
||||||
|
if (ExcludedWidgetId == o["id"].Value<long>())//whups
|
||||||
|
ExclusiveMatchCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
InclusiveMatchCount.Should().BeGreaterOrEqualTo(1);
|
||||||
|
ExclusiveMatchCount.Should().Be(0);
|
||||||
|
|
||||||
|
//DELETE WIDGETS
|
||||||
|
a = await Util.DeleteAsync("Widget/" + IncludedWidgetId.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
||||||
|
Util.ValidateHTTPStatusCode(a, 204);
|
||||||
|
|
||||||
|
a = await Util.DeleteAsync("Widget/" + ExcludedWidgetId.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
||||||
|
Util.ValidateHTTPStatusCode(a, 204);
|
||||||
|
|
||||||
|
|
||||||
|
//DELETE DATAFILTER
|
||||||
|
a = await Util.DeleteAsync("DataFilter/" + DataFilterId.ToString(), await Util.GetTokenAsync("BizAdminFull"));
|
||||||
|
Util.ValidateHTTPStatusCode(a, 204);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endregion date token filters
|
#endregion date token filters
|
||||||
//========
|
//========
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user