public void ConstructQueryOrderFunctionTest() { const String KEY1 = "key1"; const String KEY2 = "key2"; const String KEY3 = "key3"; const String KEY4 = "key4"; const String EXPECTED = "~order=key1,-key2,-key3,key4"; IList<String> expected = new List<String>(); expected.Add(EXPECTED); IStretchrRequest target = new StretchrRequest<String>(new StretchrClient(), response => { }, (request, statusCode, exception) => { }); target.Order(KEY1.SortAscending(), KEY2.SortDescending(), KEY3.SortDescending(), KEY4.SortAscending()); PrivateObject privateTarget = new PrivateObject(target); privateTarget.Invoke("ConstructQueryOrderFunction"); IList<String> actual = (IList<String>)privateTarget.GetField("_queryStringFieldValuesList"); Assert.IsNotNull(actual); Assert.AreEqual(expected.Count, actual.Count); Assert.AreEqual(expected[0], actual[0]); }
public void OrderTest() { const String KEY1 = "-key1"; const String KEY2 = "key2"; const String KEY3 = "key3"; const String KEY4 = "-key4"; IList<String> expected = new List<String>(); expected.Add(KEY1); expected.Add(KEY2); expected.Add(KEY3); expected.Add(KEY4); StretchrRequest<String> target = new StretchrRequest<String>(new StretchrClient(), response => { }, (request, statusCode, exception) => { }); target.Order("key1".SortDescending(), "key2".SortAscending(), "key3".SortAscending(), "key4".SortDescending()); IList<String> actual = target.QueryOrderFunctionParameterList; Assert.IsNotNull(actual); Assert.AreEqual(expected.Count, actual.Count); Assert.AreEqual(expected[0], actual[0]); Assert.AreEqual(expected[1], actual[1]); Assert.AreEqual(expected[2], actual[2]); Assert.AreEqual(expected[3], actual[3]); }