This commit is contained in:
188
User/UserCrud.cs
188
User/UserCrud.cs
@@ -302,127 +302,127 @@ namespace raven_integration
|
||||
|
||||
|
||||
|
||||
//This is testing datalist, not user crud, removing
|
||||
// /// <summary>
|
||||
// ///
|
||||
// /// </summary>
|
||||
// [Fact]
|
||||
// public async void UserListFilterAndSortWorks()
|
||||
// {
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void UserListFilterAndSortWorks()
|
||||
{
|
||||
// var ObjectNameStart = Util.Uniquify("UserListFilterAndSortWorks");
|
||||
|
||||
var ObjectNameStart = Util.Uniquify("UserListFilterAndSortWorks");
|
||||
// //CREATE 3 TEST OBJECTS TO TEST ORDER
|
||||
// long FirstInOrdertId = 0;
|
||||
// long SecondInOrderId = 0;
|
||||
// long ThirdInOrderId = 0;
|
||||
|
||||
//CREATE 3 TEST OBJECTS TO TEST ORDER
|
||||
long FirstInOrdertId = 0;
|
||||
long SecondInOrderId = 0;
|
||||
long ThirdInOrderId = 0;
|
||||
// dynamic d = new JObject();
|
||||
// d.name = Util.Uniquify(ObjectNameStart);
|
||||
// d.active = false;
|
||||
// d.login = Util.Uniquify("LOGIN");
|
||||
// d.password = Util.Uniquify("PASSWORD");
|
||||
// d.roles = 0;//norole
|
||||
|
||||
dynamic d = new JObject();
|
||||
d.name = Util.Uniquify(ObjectNameStart);
|
||||
d.active = false;
|
||||
d.login = Util.Uniquify("LOGIN");
|
||||
d.password = Util.Uniquify("PASSWORD");
|
||||
d.roles = 0;//norole
|
||||
// d.userType = 3;//non scheduleable
|
||||
// //Required by form custom rules
|
||||
// d.notes = "notes";
|
||||
// d.customFields = Util.UserRequiredCustomFieldsJsonString();
|
||||
|
||||
d.userType = 3;//non scheduleable
|
||||
//Required by form custom rules
|
||||
d.notes = "notes";
|
||||
d.customFields = Util.UserRequiredCustomFieldsJsonString();
|
||||
// ApiResponse a = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
|
||||
// Util.ValidateDataReturnResponseOk(a);
|
||||
// FirstInOrdertId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
ApiResponse a = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
FirstInOrdertId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
// d = new JObject();
|
||||
// d.name = Util.Uniquify(ObjectNameStart);
|
||||
// d.login = Util.Uniquify("LOGIN");
|
||||
// d.password = Util.Uniquify("PASSWORD");
|
||||
// d.roles = 0;//norole
|
||||
|
||||
d = new JObject();
|
||||
d.name = Util.Uniquify(ObjectNameStart);
|
||||
d.login = Util.Uniquify("LOGIN");
|
||||
d.password = Util.Uniquify("PASSWORD");
|
||||
d.roles = 0;//norole
|
||||
// d.userType = 3;//non scheduleable
|
||||
// d.active = true;
|
||||
// //Required by form custom rules
|
||||
// d.notes = "notes";
|
||||
// d.customFields = Util.UserRequiredCustomFieldsJsonString();
|
||||
|
||||
d.userType = 3;//non scheduleable
|
||||
d.active = true;
|
||||
//Required by form custom rules
|
||||
d.notes = "notes";
|
||||
d.customFields = Util.UserRequiredCustomFieldsJsonString();
|
||||
// a = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
|
||||
// Util.ValidateDataReturnResponseOk(a);
|
||||
// ThirdInOrderId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
a = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
ThirdInOrderId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
// d = new JObject();
|
||||
// d.name = Util.Uniquify(ObjectNameStart);
|
||||
// d.login = Util.Uniquify("LOGIN");
|
||||
// d.password = Util.Uniquify("PASSWORD");
|
||||
// d.roles = 0;//norole
|
||||
|
||||
d = new JObject();
|
||||
d.name = Util.Uniquify(ObjectNameStart);
|
||||
d.login = Util.Uniquify("LOGIN");
|
||||
d.password = Util.Uniquify("PASSWORD");
|
||||
d.roles = 0;//norole
|
||||
// d.userType = 3;//non scheduleable
|
||||
// d.active = false;
|
||||
// //Required by form custom rules
|
||||
// d.notes = "notes";
|
||||
// d.customFields = Util.UserRequiredCustomFieldsJsonString();
|
||||
|
||||
d.userType = 3;//non scheduleable
|
||||
d.active = false;
|
||||
//Required by form custom rules
|
||||
d.notes = "notes";
|
||||
d.customFields = Util.UserRequiredCustomFieldsJsonString();
|
||||
|
||||
a = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
SecondInOrderId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
// a = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
|
||||
// Util.ValidateDataReturnResponseOk(a);
|
||||
// SecondInOrderId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||
|
||||
|
||||
//CREATE FILTER
|
||||
// //CREATE FILTER
|
||||
|
||||
//FILTER IN BY NAME FOR TESTING THIS RUN ONLY
|
||||
// dynamic dfilter = new JArray();
|
||||
// //name starts with filter to constrict to widgets that this test block created only
|
||||
// dynamic DataFilterNameStart = new JObject();
|
||||
// DataFilterNameStart.fld = "username";
|
||||
// DataFilterNameStart.op = Util.OpStartsWith;
|
||||
// DataFilterNameStart.value = ObjectNameStart;
|
||||
// dfilter.Add(DataFilterNameStart);
|
||||
// //FILTER IN BY NAME FOR TESTING THIS RUN ONLY
|
||||
// // dynamic dfilter = new JArray();
|
||||
// // //name starts with filter to constrict to widgets that this test block created only
|
||||
// // dynamic DataFilterNameStart = new JObject();
|
||||
// // DataFilterNameStart.fld = "username";
|
||||
// // DataFilterNameStart.op = Util.OpStartsWith;
|
||||
// // DataFilterNameStart.value = ObjectNameStart;
|
||||
// // dfilter.Add(DataFilterNameStart);
|
||||
|
||||
// dynamic dsortarray = new JArray();
|
||||
// // dynamic dsortarray = new JArray();
|
||||
|
||||
//SORT ORDER ###################
|
||||
//sort by active then by ID
|
||||
// //SORT ORDER ###################
|
||||
// //sort by active then by ID
|
||||
|
||||
// dynamic dsort = new JObject();
|
||||
// dsort.fld = "useractive";
|
||||
// dsort.dir = "+";
|
||||
// dsortarray.Add(dsort);
|
||||
// // dynamic dsort = new JObject();
|
||||
// // dsort.fld = "useractive";
|
||||
// // dsort.dir = "+";
|
||||
// // dsortarray.Add(dsort);
|
||||
|
||||
// dsort = new JObject();
|
||||
// dsort.fld = "df";
|
||||
// dsort.dir = "+";
|
||||
// dsortarray.Add(dsort);
|
||||
// // dsort = new JObject();
|
||||
// // dsort.fld = "df";
|
||||
// // dsort.dir = "+";
|
||||
// // dsortarray.Add(dsort);
|
||||
|
||||
dynamic dListView = new JArray();
|
||||
//name starts with filter to constrict to widgets that this test block created only
|
||||
dListView.Add(Util.BuildSimpleFilterDataListViewColumn("username", Util.OpStartsWith, ObjectNameStart));
|
||||
dListView.Add(Util.BuildSimpleSortDataListViewColumn("useractive", "+"));
|
||||
//DEPRECATED NO DF ANYMORE dListView.Add(Util.BuildSimpleSortDataListViewColumn("df", "+"));
|
||||
// dynamic dListView = new JArray();
|
||||
// //name starts with filter to constrict to widgets that this test block created only
|
||||
// dListView.Add(Util.BuildSimpleFilterDataListViewColumn("username", Util.OpStartsWith, ObjectNameStart));
|
||||
// dListView.Add(Util.BuildSimpleSortDataListViewColumn("useractive", "+"));
|
||||
// //DEPRECATED NO DF ANYMORE dListView.Add(Util.BuildSimpleSortDataListViewColumn("df", "+"));
|
||||
|
||||
//NOW FETCH WIDGET LIST WITH FILTER UserDataList
|
||||
// a = await Util.GetAsync($"DataList/list?DataListKey=UserDataList&Offset=0&Limit=999&DataFilterId={DataFilterId.ToString()}", await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
a = await Util.PostAsync($"DataList", await Util.GetTokenAsync("manager", "l3tm3in"), Util.BuildDataListRequestEx(dListView, 999, 0, "TestUserDataList"));
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
Util.ValidateHTTPStatusCode(a, 200);
|
||||
// //NOW FETCH WIDGET LIST WITH FILTER UserDataList
|
||||
// // a = await Util.GetAsync($"DataList/list?DataListKey=UserDataList&Offset=0&Limit=999&DataFilterId={DataFilterId.ToString()}", await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
// a = await Util.PostAsync($"DataList", await Util.GetTokenAsync("manager", "l3tm3in"), Util.BuildDataListRequestEx(dListView, 999, 0, "TestUserDataList"));
|
||||
// Util.ValidateDataReturnResponseOk(a);
|
||||
// Util.ValidateHTTPStatusCode(a, 200);
|
||||
|
||||
//assert contains exactly 3 records
|
||||
((JArray)a.ObjectResponse["data"]).Count.Should().Be(3);
|
||||
// //assert contains exactly 3 records
|
||||
// ((JArray)a.ObjectResponse["data"]).Count.Should().Be(3);
|
||||
|
||||
//assert the order returned
|
||||
a.ObjectResponse["data"][0][0]["i"].Value<long>().Should().Be(FirstInOrdertId);
|
||||
a.ObjectResponse["data"][1][0]["i"].Value<long>().Should().Be(SecondInOrderId);
|
||||
a.ObjectResponse["data"][2][0]["i"].Value<long>().Should().Be(ThirdInOrderId);
|
||||
// //assert the order returned
|
||||
// a.ObjectResponse["data"][0][0]["i"].Value<long>().Should().Be(FirstInOrdertId);
|
||||
// a.ObjectResponse["data"][1][0]["i"].Value<long>().Should().Be(SecondInOrderId);
|
||||
// a.ObjectResponse["data"][2][0]["i"].Value<long>().Should().Be(ThirdInOrderId);
|
||||
|
||||
|
||||
a = await Util.DeleteAsync("User/" + FirstInOrdertId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
Util.ValidateHTTPStatusCode(a, 204);
|
||||
// a = await Util.DeleteAsync("User/" + FirstInOrdertId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
// Util.ValidateHTTPStatusCode(a, 204);
|
||||
|
||||
a = await Util.DeleteAsync("User/" + SecondInOrderId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
Util.ValidateHTTPStatusCode(a, 204);
|
||||
// a = await Util.DeleteAsync("User/" + SecondInOrderId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
// Util.ValidateHTTPStatusCode(a, 204);
|
||||
|
||||
a = await Util.DeleteAsync("User/" + ThirdInOrderId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
Util.ValidateHTTPStatusCode(a, 204);
|
||||
// a = await Util.DeleteAsync("User/" + ThirdInOrderId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||
// Util.ValidateHTTPStatusCode(a, 204);
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
|
||||
//==================================================
|
||||
|
||||
Reference in New Issue
Block a user