public void ApplyFilterToData_MultiFiltersCombo_DataFiltered() { // arrange var row1 = "{\"MixrData\":{\"BedReserved\":\"gary\"},\"BedDescription\":\"Nikau Rm 5\",\"BedId\":\"05\",\"KeyValueGroup\":\"TPW_05\",\"AdmissionData\":{\"MixrData\":{},\"KeyValueGroup\":\"6719253\",\"Admission\":{\"OnLeave\":\"true\"}}}"; var row2 = "{\"MixrData\":{},\"BedDescription\":\"Nikau Rm 10\",\"BedId\":\"10\",\"KeyValueGroup\":\"TPW_10\",\"AdmissionData\":{\"MixrData\":{},\"KeyValueGroup\":\"1111111\",\"Admission\":{\"OnLeave\":\"false\"}}}"; var row3 = "{\"MixrData\":{},\"BedDescription\":\"Nikau Rm 2\",\"BedId\":\"02\",\"KeyValueGroup\":\"TPW_02\",\"AdmissionData\":{\"MixrData\":{},\"KeyValueGroup\":\"222222\",\"Admission\":{\"OnLeave\":\"false\"}}}"; var rawData = "{\"Location\":{\"KeyValueGroup\":\"TPW\",\"Rows\":[" + row1 + "," + row2 + "," + row3 + "]}}"; var expectedData = "{\"Location\":{\"KeyValueGroup\":\"TPW\",\"Rows\":[" + row1 + "]}}"; var dataFilters = new List <DataFilter> { new DataFilter { Active = true, FilterRoot = "Location.Rows", PropertyNameToFilterOn = "BedId", FilterItemValues = "05,02", FilterType = "Include" }, new DataFilter { Active = true, FilterRoot = "Location.Rows", PropertyNameToFilterOn = "BedDescription", FilterItemValues = "Nikau Rm 2", FilterType = "Exclude" } }; // act var data = JsonManipulate.ApplyManipulationsToData(rawData, dataFilters, new List <DataSort>()); // assert Assert.AreEqual(expectedData, data); }
public void ApplySortToData_MultiSort_DataSorted() { // arrange var row1 = "{\"MixrData\":{\"BedReserved\":\"gary\"},\"BedDescription\":\"Nikau Rm 5\",\"BedId\":\"05\",\"KeyValueGroup\":\"TPW_05\",\"AdmissionData\":{\"MixrData\":{},\"KeyValueGroup\":\"6719253\",\"Admission\":{\"OnLeave\":\"true\"}}}"; var row2 = "{\"MixrData\":{},\"BedDescription\":\"Nikau Rm 10\",\"BedId\":\"10\",\"KeyValueGroup\":\"TPW_10\",\"AdmissionData\":{\"MixrData\":{},\"KeyValueGroup\":\"1111111\",\"Admission\":{\"OnLeave\":\"false\"}}}"; var row3 = "{\"MixrData\":{},\"BedDescription\":\"Nikau Rm 2\",\"BedId\":\"02\",\"KeyValueGroup\":\"TPW_02\",\"AdmissionData\":{\"MixrData\":{},\"KeyValueGroup\":\"222222\",\"Admission\":{\"OnLeave\":\"false\"}}}"; var rawData = "{\"Location\":{\"KeyValueGroup\":\"TPW\",\"Rows\":[" + row1 + "," + row2 + "," + row3 + "]}}"; var expectedData = "{\"Location\":{\"KeyValueGroup\":\"TPW\",\"Rows\":[" + row3 + "," + row1 + "," + row2 + "]}}"; var DataSorts = new List <DataSort> { new DataSort { Active = true, Direction = "asc", Field = "BedId", Order = 2 }, new DataSort { Active = true, Direction = "asc", Field = "AdmissionData.Admission.OnLeave", Order = 1 } }; // act var data = JsonManipulate.ApplyManipulationsToData(rawData, new List <DataFilter>(), DataSorts); // assert Assert.AreEqual(expectedData, data); }
public void ApplyFilterToData_NoFilters_DataUnchanged() { // arrange var row1 = "{\"MixrData\":{\"BedReserved\":\"gary\"},\"BedDescription\":\"Nikau Rm 5\",\"BedId\":\"05\",\"KeyValueGroup\":\"TPW_05\",\"AdmissionData\":{\"MixrData\":{},\"KeyValueGroup\":\"6719253\",\"Admission\":{\"OnLeave\":\"true\"}}}"; var row2 = "{\"MixrData\":{},\"BedDescription\":\"Nikau Rm 10\",\"BedId\":\"10\",\"KeyValueGroup\":\"TPW_10\",\"AdmissionData\":{\"MixrData\":{},\"KeyValueGroup\":\"1111111\",\"Admission\":{\"OnLeave\":\"false\"}}}"; var row3 = "{\"MixrData\":{},\"BedDescription\":\"Nikau Rm 2\",\"BedId\":\"02\",\"KeyValueGroup\":\"TPW_02\",\"AdmissionData\":{\"MixrData\":{},\"KeyValueGroup\":\"222222\",\"Admission\":{\"OnLeave\":\"false\"}}}"; var rawData = "{\"Location\":{\"KeyValueGroup\":\"TPW\",\"Rows\":[" + row1 + "," + row2 + "," + row3 + "]}}"; // act var data = JsonManipulate.ApplyManipulationsToData(rawData, new List <DataFilter>(), new List <DataSort>()); // assert Assert.AreEqual(rawData, data); }