This commit is contained in:
2020-02-14 22:56:56 +00:00
parent 08253b6623
commit 8937aa0e9a

View File

@@ -659,7 +659,7 @@ same as the server does but in a central location here for all tests to use.
dynamic filter = new JObject();
dynamic items = new JArray();
dynamic fitem = new JObject();
fitem.op = Util.OpGreaterThanOrEqualTo;
fitem.value = new DateTime(2019, 3, 12, 10, 0, 0).ToOffsetAdjustedUniversalTime();
@@ -675,10 +675,10 @@ same as the server does but in a central location here for all tests to use.
d.filter = filter;
dListView.Add(d);
/*
"SELECT awidget.id AS df, awidget.name, awidget.id, awidget.startdate from awidget left outer join auser on (awidget.userid=auser.id) where (awidget.name Like 'DateOpBetweenFilterWorks%') AND ((awidget.startdate >='2019-03-12T18:00:00.0000000') AND awidget.startdate Is Null OR awidget.startdate <='2019-03-12T19:00:00.9990000Z')) ORDER BY awidget.id DESC LIMIT 999 OFFSET 0"
" where (awidget.name Like 'DateOpBetweenFilterWorks%') AND ((awidget.startdate >='2019-03-12T18:00:00.0000000') AND awidget.startdate Is Null OR awidget.startdate <='2019-03-12T19:00:00.9990000Z'))"
*/
/*
"SELECT awidget.id AS df, awidget.name, awidget.id, awidget.startdate from awidget left outer join auser on (awidget.userid=auser.id) where (awidget.name Like 'DateOpBetweenFilterWorks%') AND ((awidget.startdate >='2019-03-12T18:00:00.0000000') AND awidget.startdate Is Null OR awidget.startdate <='2019-03-12T19:00:00.9990000Z')) ORDER BY awidget.id DESC LIMIT 999 OFFSET 0"
" where (awidget.name Like 'DateOpBetweenFilterWorks%') AND ((awidget.startdate >='2019-03-12T18:00:00.0000000') AND awidget.startdate Is Null OR awidget.startdate <='2019-03-12T19:00:00.9990000Z'))"
*/
//FETCH DATALIST
@@ -3705,5 +3705,63 @@ same as the server does but in a central location here for all tests to use.
#endregion tag tests
//==================================================
///////////////////////////////////////////////////////////////////////////////
//FILTER BY ID VALUE
//
#region ID FILTER TESTS
/// <summary>
///
/// </summary>
[Fact]
public async void IdFilterWorks()
{
var TestName = "IdFilterWorks";
var WidgetNameStart = Util.Uniquify(TestName);
//CREATE WIDGET
dynamic w = new JObject();
w.name = Util.Uniquify(WidgetNameStart);
w.customFields = Util.WidgetRequiredCustomFieldsJsonString();
w.notes = "ID FILTER NOTES";
w.usertype = 1;
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), w.ToString());
Util.ValidateDataReturnResponseOk(a);
long Id = a.ObjectResponse["data"]["id"].Value<long>();
//CREATE LISTVIEW
dynamic dListView = new JArray();
//FILTER
dListView.Add(Util.BuildSimpleFilterDataListViewColumn("widgetname", Util.OpEquality, Id));
//FETCH DATALIST
a = await Util.PostAsync($"DataList", await Util.GetTokenAsync("manager", "l3tm3in"), Util.BuildDataListRequestEx(dListView));
Util.ValidateDataReturnResponseOk(a);
Util.ValidateHTTPStatusCode(a, 200);
//assert contains ONE record ONLY
((JArray)a.ObjectResponse["data"]).Count.Should().Be(1);
//assert it's ours
((JArray)a.ObjectResponse["data"])[0][0]["v"].Value<long>().Should().Be(Id);
// v[0]["v"].Value<long>()
//DELETE WIDGET
a = await Util.DeleteAsync("Widget/" + Id.ToString(), await Util.GetTokenAsync("BizAdminFull"));
Util.ValidateHTTPStatusCode(a, 204);
}
#endregion ID filter tests
//==================================================
}//eoc
}//eons