diff --git a/PickList/PickListAllTests.cs b/PickList/PickListAllTests.cs index 9bcda48..4a25805 100644 --- a/PickList/PickListAllTests.cs +++ b/PickList/PickListAllTests.cs @@ -189,12 +189,8 @@ namespace raven_integration //make key widget var WidgetNameStart = "FetchWidgetPickListAutoComplete_UnIqUe"; - long IncludedWidgetId = 0; - - //CREATE TEST WIDGETS - //included widget dynamic w = new JObject(); w.name = Util.Uniquify(WidgetNameStart); @@ -222,6 +218,51 @@ namespace raven_integration Util.ValidateHTTPStatusCode(a, 204); } + + /// + /// + /// + [Fact] + public async void FetchWidgetPickListTags() + { + + //make key widget + var WidgetNameStart = "FetchWidgetPickListTags"; + long IncludedWidgetId = 0; + //CREATE TEST WIDGETS + //included widget + dynamic w = new JObject(); + w.name = Util.Uniquify(WidgetNameStart); + w.customFields = Util.WidgetRequiredCustomFieldsJsonString(); + w.notes = "blah"; + w.active = true; + w.usertype = 1; + w.dollarAmount = 555.55; + //Tags + dynamic InclusiveTagsArray = new JArray(); + InclusiveTagsArray.Add("plred"); + InclusiveTagsArray.Add("plblue"); + w.tags = InclusiveTagsArray; + + ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), w.ToString()); + Util.ValidateDataReturnResponseOk(a); + IncludedWidgetId = a.ObjectResponse["data"]["id"].Value(); + + + //RETRIEVE WIDGET PICKLIST with name filter + a = await Util.GetAsync("PickList/List?ayaType=2&query=..lblu", await Util.GetTokenAsync("BizAdminFull")); + Util.ValidateDataReturnResponseOk(a); + //assert contains 100 records (current picklist maximum count) + var pickList = ((JArray)a.ObjectResponse["data"]); + pickList.Count.Should().Be(1); + pickList[0]["id"].Value().Should().Be(IncludedWidgetId); + + //DELETE WIDGETS + a = await Util.DeleteAsync("Widget/" + IncludedWidgetId.ToString(), await Util.GetTokenAsync("BizAdminFull")); + Util.ValidateHTTPStatusCode(a, 204); + } + + //same as above but tag filter version test returns correct record