This commit is contained in:
@@ -380,7 +380,7 @@ namespace AyaNova
|
|||||||
// ******************** TESTING WIPE DB *****************************
|
// ******************** TESTING WIPE DB *****************************
|
||||||
//
|
//
|
||||||
//Set this to true to wipe the db and reinstall a trial license and re-seed the data
|
//Set this to true to wipe the db and reinstall a trial license and re-seed the data
|
||||||
var TESTING_REFRESH_DB = false;//#############################################################################################
|
var TESTING_REFRESH_DB = true;//#############################################################################################
|
||||||
|
|
||||||
#if (DEBUG)
|
#if (DEBUG)
|
||||||
//TESTING
|
//TESTING
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(dataFilter.Sort))
|
if (string.IsNullOrWhiteSpace(dataFilter.Sort))
|
||||||
{
|
{
|
||||||
return "";
|
return DefaultOrderBy();
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace AyaNova.Util
|
|||||||
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::PrepareDatabaseForSeeding WHEN NEW TABLES ADDED!!!!
|
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::PrepareDatabaseForSeeding WHEN NEW TABLES ADDED!!!!
|
||||||
private const int DESIRED_SCHEMA_LEVEL = 8;
|
private const int DESIRED_SCHEMA_LEVEL = 8;
|
||||||
|
|
||||||
internal const long EXPECTED_COLUMN_COUNT = 94;
|
internal const long EXPECTED_COLUMN_COUNT = 95;
|
||||||
internal const long EXPECTED_INDEX_COUNT = 20;
|
internal const long EXPECTED_INDEX_COUNT = 20;
|
||||||
|
|
||||||
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::PrepareDatabaseForSeeding WHEN NEW TABLES ADDED!!!!
|
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::PrepareDatabaseForSeeding WHEN NEW TABLES ADDED!!!!
|
||||||
|
|||||||
@@ -11,7 +11,90 @@ namespace raven_integration
|
|||||||
|
|
||||||
public class DataFilterOrderBy
|
public class DataFilterOrderBy
|
||||||
{
|
{
|
||||||
|
public const string OpStartsWith = "%-";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
[Fact]
|
||||||
|
public async void DefaultSortByIdWorks()
|
||||||
|
{
|
||||||
|
|
||||||
|
var WidgetNameStart = Util.Uniquify("DefaultSortByIdWorks");
|
||||||
|
|
||||||
|
//CREATE 3 TEST WIDGETS TO TEST ORDER
|
||||||
|
long FirstInOrderWidgetId = 0;
|
||||||
|
long SecondInOrderWidgetId = 0;
|
||||||
|
long ThirdInOrderWidgetId = 0;
|
||||||
|
|
||||||
|
dynamic w = new JObject();
|
||||||
|
w.name = Util.Uniquify(WidgetNameStart);
|
||||||
|
ApiResponse a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), w.ToString());
|
||||||
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
|
ThirdInOrderWidgetId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||||
|
|
||||||
|
w = new JObject();
|
||||||
|
w.name = Util.Uniquify(WidgetNameStart);
|
||||||
|
a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), w.ToString());
|
||||||
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
|
SecondInOrderWidgetId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||||
|
|
||||||
|
w = new JObject();
|
||||||
|
w.name = Util.Uniquify(WidgetNameStart);
|
||||||
|
a = await Util.PostAsync("Widget", await Util.GetTokenAsync("manager", "l3tm3in"), w.ToString());
|
||||||
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
|
FirstInOrderWidgetId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||||
|
|
||||||
|
|
||||||
|
//CREATE FILTER
|
||||||
|
dynamic d = new JObject();
|
||||||
|
d.name = Util.Uniquify(WidgetNameStart);
|
||||||
|
d["public"] = true;
|
||||||
|
d.listKey = "widget";
|
||||||
|
dynamic dfilter = new JArray();
|
||||||
|
|
||||||
|
|
||||||
|
//name starts with filter to constrict to widgets that this test block created only
|
||||||
|
dynamic DataFilterNameStart = new JObject();
|
||||||
|
DataFilterNameStart.fld = "name";
|
||||||
|
DataFilterNameStart.op = OpStartsWith;
|
||||||
|
DataFilterNameStart.value = WidgetNameStart;
|
||||||
|
dfilter.Add(DataFilterNameStart);
|
||||||
|
d.filter = dfilter.ToString();//it expects it to be a json string, not actual json
|
||||||
|
|
||||||
|
a = await Util.PostAsync("DataFilter", await Util.GetTokenAsync("manager", "l3tm3in"), d.ToString());
|
||||||
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
|
|
||||||
|
long DataFilterId = a.ObjectResponse["data"]["id"].Value<long>();
|
||||||
|
|
||||||
|
//NOW FETCH WIDGET LIST WITH FILTER
|
||||||
|
a = await Util.GetAsync($"Widget/listwidgets?Offset=0&Limit=999&DataFilterId={DataFilterId.ToString()}", await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||||
|
Util.ValidateDataReturnResponseOk(a);
|
||||||
|
Util.ValidateHTTPStatusCode(a, 200);
|
||||||
|
|
||||||
|
//assert contains exactly 3 records
|
||||||
|
((JArray)a.ObjectResponse["data"]).Count.Should().Be(3);
|
||||||
|
|
||||||
|
//assert the order returned
|
||||||
|
a.ObjectResponse["data"][0]["id"].Value<long>().Should().Be(FirstInOrderWidgetId);
|
||||||
|
a.ObjectResponse["data"][1]["id"].Value<long>().Should().Be(SecondInOrderWidgetId);
|
||||||
|
a.ObjectResponse["data"][2]["id"].Value<long>().Should().Be(ThirdInOrderWidgetId);
|
||||||
|
|
||||||
|
|
||||||
|
a = await Util.DeleteAsync("Widget/" + FirstInOrderWidgetId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||||
|
Util.ValidateHTTPStatusCode(a, 204);
|
||||||
|
|
||||||
|
a = await Util.DeleteAsync("Widget/" + SecondInOrderWidgetId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||||
|
Util.ValidateHTTPStatusCode(a, 204);
|
||||||
|
|
||||||
|
a = await Util.DeleteAsync("Widget/" + ThirdInOrderWidgetId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||||
|
Util.ValidateHTTPStatusCode(a, 204);
|
||||||
|
|
||||||
|
//DELETE DATAFILTER
|
||||||
|
a = await Util.DeleteAsync("DataFilter/" + DataFilterId.ToString(), await Util.GetTokenAsync("manager", "l3tm3in"));
|
||||||
|
Util.ValidateHTTPStatusCode(a, 204);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}//eoc
|
}//eoc
|
||||||
}//eons
|
}//eons
|
||||||
|
|||||||
Reference in New Issue
Block a user