This commit is contained in:
64
test/raven-integration/Search/SearchOps.cs
Normal file
64
test/raven-integration/Search/SearchOps.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using System;
|
||||
using Xunit;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using FluentAssertions;
|
||||
|
||||
namespace raven_integration
|
||||
{
|
||||
|
||||
public class SearchOps
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Test simple phrase only search
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async void PhraseOnlySearchShouldWork()
|
||||
{
|
||||
|
||||
//CREATE A WIDGET
|
||||
dynamic D = new JObject();
|
||||
D.name = Util.Uniquify("Search Simple Test WIDGET");
|
||||
D.dollarAmount = 1.11m;
|
||||
D.active = true;
|
||||
D.roles = 0;
|
||||
D.notes = "The quick brown and simple fox jumped over the six lazy dogs!";
|
||||
|
||||
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long FirstWidgetId = a.ObjectResponse["result"]["id"].Value<long>();
|
||||
|
||||
D = new JObject();
|
||||
D.name = Util.Uniquify("Search Simple SECOND Test WIDGET");
|
||||
D.dollarAmount = 1.11m;
|
||||
D.active = true;
|
||||
D.roles = 0;
|
||||
D.notes = "This Widget should not be returned in the search as it only contains a single keyword in the name not both";
|
||||
|
||||
a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), D.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
long SecondWidgetId = a.ObjectResponse["result"]["id"].Value<long>();
|
||||
|
||||
//Now see if can find that widget with a phrase search
|
||||
dynamic SearchParameters = new JObject();
|
||||
SearchParameters.phrase = "simple dogs";
|
||||
SearchParameters.nameOnly = false;
|
||||
SearchParameters.typeOnly = 0;//no type
|
||||
a = await Util.PostAsync("Search", await Util.GetTokenAsync("manager", "l3tm3in"), SearchParameters.ToString());
|
||||
Util.ValidateDataReturnResponseOk(a);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//==================================================
|
||||
|
||||
}//eoc
|
||||
}//eons
|
||||
Reference in New Issue
Block a user