This commit is contained in:
2018-12-13 19:33:25 +00:00
parent 49cfd66c65
commit c92bf812a7
4 changed files with 56 additions and 11 deletions

View File

@@ -5,12 +5,7 @@ Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOiIxNTQ0NTU5NzAwIiwiZXhwIjoi
## IMMEDIATE ITEMS
Item below half done: widget picklist is done, might need test cleanup for that, user picklist needs to have code copied
Widget and user picklist, modify to use filter and sort criteria, remove the startswith built in filter
- Fix up the old tests for picklists and replace with new test using filter ID
- Don't forget to test with no filter ID to ensure still works as normal (default picklist should sort by alpha, need extra default method for sql query)
GetMany - have a look at the widget getmany code and the get picklist utility helper and see if there is a possibility of moving the getmany code into a helper similarly to picklist
ENUM

View File

@@ -227,12 +227,8 @@ namespace AyaNova.Biz
{
pagingOptions.Offset = pagingOptions.Offset ?? PagingOptions.DefaultOffset;
pagingOptions.Limit = pagingOptions.Limit ?? PagingOptions.DefaultLimit;
var ret = PickListFetcher.GetPickList(ct, UserId, pagingOptions, "awidget");
var pageLinks = new PaginationLinkBuilder(Url, routeName, null, pagingOptions, ret.TotalRecordCount).PagingLinksObject();
ApiPagedResponse<NameIdItem> pr = new ApiPagedResponse<NameIdItem>(ret.Items, pageLinks);
return pr;
}

View File

@@ -436,6 +436,30 @@ namespace raven_integration
}
/// <summary>
///
/// </summary>
[Fact]
public async void UserPickListDefaultSortNoFilterWorks()
{
var RouteName = "User";//##########
//NOW FETCH LIST WITH FILTER
ApiResponse a = await Util.GetAsync($"{RouteName}/picklist?Offset=0&Limit=999", await Util.GetTokenAsync("manager", "l3tm3in"));
Util.ValidateDataReturnResponseOk(a);
Util.ValidateHTTPStatusCode(a, 200);
//assert contains exactly 3 records
var ItemCount = ((JArray)a.ObjectResponse["data"]).Count;
for (int i = 0; i < ItemCount - 1; i++)
{
var firstName = a.ObjectResponse["data"][i]["name"].Value<string>().Replace(" ","");
var secondName = a.ObjectResponse["data"][i + 1]["name"].Value<string>().Replace(" ","");
int comparison = String.Compare(firstName, secondName, comparisonType: StringComparison.OrdinalIgnoreCase);
comparison.Should().BeNegative();
}
}

View File

@@ -12,6 +12,36 @@ namespace raven_integration
public class WidgetLists
{
/// <summary>
///
/// </summary>
[Fact]
public async void WidgetPickListDefaultSortNoFilterWorks()
{
var RouteName = "Widget";//##########
//NOW FETCH LIST WITH FILTER
ApiResponse a = await Util.GetAsync($"{RouteName}/picklist?Offset=0&Limit=999", await Util.GetTokenAsync("manager", "l3tm3in"));
Util.ValidateDataReturnResponseOk(a);
Util.ValidateHTTPStatusCode(a, 200);
//assert contains exactly 3 records
var ItemCount = ((JArray)a.ObjectResponse["data"]).Count;
for (int i = 0; i < ItemCount - 1; i++)
{
//Note it's necessary to replace the spaces because postgres thinks spaces go last and the string comparison thinks they go first
var firstName = a.ObjectResponse["data"][i]["name"].Value<string>().Replace(" ","");
var secondName = a.ObjectResponse["data"][i + 1]["name"].Value<string>().Replace(" ","");
int comparison = String.Compare(firstName, secondName, comparisonType: StringComparison.OrdinalIgnoreCase);
comparison.Should().BeNegative();
}
}
/// <summary>
///
/// </summary>
@@ -20,7 +50,7 @@ namespace raven_integration
{
var NameStart = Util.Uniquify("WidgetPickListSortByFieldAscendingWorks");
var RouteName="Widget";
var RouteName = "Widget";
//CREATE 3 TEST OBJECTS TO TEST ORDER
long FirstInOrderId = 0;