This commit is contained in:
@@ -284,6 +284,68 @@ namespace raven_integration
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async void WildCardContainsSearchShouldWork()
|
||||||
|
{
|
||||||
|
const string TEST_SEARCH_PHRASE = "*cast* goose";
|
||||||
|
|
||||||
|
//CREATE A WIDGET
|
||||||
|
dynamic D = new JObject();
|
||||||
|
D.name = Util.Uniquify("Wildcard contains search test WIDGET");
|
||||||
|
D.dollarAmount = 1.11m;
|
||||||
|
D.active = true;
|
||||||
|
D.roles = 0;
|
||||||
|
D.notes = "This record will match in notes: broadcasting to the goose";
|
||||||
|
|
||||||
|
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
|
||||||
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
|
long MatchWidgetInNotesId = a.ObjectResponse["result"]["id"].Value<long>();
|
||||||
|
|
||||||
|
//CREATE FIRST TEST USER WITH PHRASE IN NAME
|
||||||
|
D = new JObject();
|
||||||
|
D.name = Util.Uniquify("Wildcard contains search NAME goose elcastro Test User");
|
||||||
|
D.notes = "This user has the match in it's name";
|
||||||
|
D.ownerId = 1L;
|
||||||
|
D.active = true;
|
||||||
|
D.login = Util.Uniquify("LOGIN");
|
||||||
|
D.password = Util.Uniquify("PASSWORD");
|
||||||
|
D.roles = 0;//norole
|
||||||
|
D.localeId = 1;//random locale
|
||||||
|
D.userType = 3;//non scheduleable
|
||||||
|
|
||||||
|
a = await Util.PostAsync("User", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
|
||||||
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
|
long MatchUserInNameId = a.ObjectResponse["result"]["id"].Value<long>();
|
||||||
|
|
||||||
|
|
||||||
|
//Now see if can find those objects with a phrase search
|
||||||
|
dynamic SearchParameters = new JObject();
|
||||||
|
|
||||||
|
SearchParameters.phrase = TEST_SEARCH_PHRASE;
|
||||||
|
SearchParameters.nameOnly = false;
|
||||||
|
SearchParameters.typeOnly = 0;//no type
|
||||||
|
a = await Util.PostAsync("Search", await Util.GetTokenAsync("manager", "l3tm3in"), SearchParameters.ToString());
|
||||||
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
|
|
||||||
|
//Now validate the return list
|
||||||
|
((JArray)a.ObjectResponse["result"]).Count.Should().BeGreaterOrEqualTo(2);
|
||||||
|
|
||||||
|
//Turn the list into an array of id's
|
||||||
|
var v = ((JArray)a.ObjectResponse["result"]);
|
||||||
|
List<long> MatchingIdList = new List<long>();
|
||||||
|
foreach (JObject j in v)
|
||||||
|
{
|
||||||
|
MatchingIdList.Add(j["id"].Value<long>());
|
||||||
|
}
|
||||||
|
|
||||||
|
//Ensure the expected items are returned
|
||||||
|
MatchingIdList.Should().Contain(MatchWidgetInNotesId, "ShouldContainMatchWidgetInNotesId");
|
||||||
|
MatchingIdList.Should().Contain(MatchUserInNameId, "ShouldContainMatchUserInNameId");
|
||||||
|
|
||||||
|
}//eot
|
||||||
|
|
||||||
|
|
||||||
//TODO: TAG SEARCH ALONE TEST
|
//TODO: TAG SEARCH ALONE TEST
|
||||||
|
|
||||||
//TODO: TAG PLUS SEARCH PHRASE TEST
|
//TODO: TAG PLUS SEARCH PHRASE TEST
|
||||||
|
|||||||
Reference in New Issue
Block a user