public void TransformSQLOrderByError() { ModelStateDictionary wrapper = new ModelStateDictionary(); AdvancedSearch search1 = new AdvancedSearch(); search1.ToSQL("Document/whereas/id/eq/10/Orderby/count", "1", wrapper); Assert.AreEqual(1, wrapper.Count); ModelStateDictionary wrapper2 = new ModelStateDictionary(); AdvancedSearch search2 = new AdvancedSearch(); search2.ToSQL("Document/whereas/id/eq/10/Orderby/id/aaa", "1", wrapper2); Assert.AreEqual(1, wrapper2.Count); ModelStateDictionary wrapper3 = new ModelStateDictionary(); AdvancedSearch search3 = new AdvancedSearch(); search3.ToSQL("Document/whereas/id/eq/10/Orderby/id", "1", wrapper3); Assert.AreEqual(1, wrapper3.Count); ModelStateDictionary wrapper4 = new ModelStateDictionary(); AdvancedSearch search4 = new AdvancedSearch(); search4.ToSQL("Document/whereas/id/eq/10/Orderby/OrderBy/id/asc", "1", wrapper4); Assert.AreEqual(1, wrapper4.Count); ModelStateDictionary wrapper5 = new ModelStateDictionary(); AdvancedSearch search5 = new AdvancedSearch(); search5.ToSQL("Document/OrderBy/id/asc/whereas/id/eq/10///", "1", wrapper5); Assert.AreEqual(1, wrapper5.Count); ModelStateDictionary wrapper6 = new ModelStateDictionary(); AdvancedSearch search6 = new AdvancedSearch(); search6.ToSQL("Document/OrderBy/id/asc/whereas/id/eq/10", "1", wrapper6); Assert.AreEqual(1, wrapper6.Count); }
public void TransformSQLSlashes() { ModelStateDictionary wrapper = new ModelStateDictionary(); AdvancedSearch search1 = new AdvancedSearch(); search1.ToSQL("///////", "1", wrapper); Assert.AreEqual(1, wrapper.Count); ModelStateDictionary wrapper2 = new ModelStateDictionary(); AdvancedSearch search2 = new AdvancedSearch(); search2.ToSQL("/", "1", wrapper2); Assert.AreEqual(1, wrapper2.Count); ModelStateDictionary wrapper3 = new ModelStateDictionary(); AdvancedSearch search3 = new AdvancedSearch(); search3.ToSQL("//", "1", wrapper3); Assert.AreEqual(1, wrapper3.Count); ModelStateDictionary wrapper4 = new ModelStateDictionary(); AdvancedSearch search4 = new AdvancedSearch(); search4.ToSQL("/Document/", "1", wrapper4); Assert.AreEqual(1, wrapper4.Count); ModelStateDictionary wrapper5 = new ModelStateDictionary(); AdvancedSearch search5 = new AdvancedSearch(); search5.ToSQL("/where/id/eq/10", "1", wrapper5); Assert.AreEqual(1, wrapper5.Count); ModelStateDictionary wrapper6 = new ModelStateDictionary(); AdvancedSearch search6 = new AdvancedSearch(); search6.ToSQL("/and/and/and/and", "1", wrapper6); Assert.AreEqual(1, wrapper6.Count); }
public void TransformSQLCountError() { ModelStateDictionary wrapper = new ModelStateDictionary(); AdvancedSearch search = new AdvancedSearch(); search.ToSQL("Document/whereas/id/eq/10/count/count", "1", wrapper); Assert.AreEqual(1, wrapper.Count); ModelStateDictionary wrapper2 = new ModelStateDictionary(); AdvancedSearch search2 = new AdvancedSearch(); search2.ToSQL("Document/whereas/id/eq/10/limit/5/count", "1", wrapper2); Assert.AreEqual(1, wrapper2.Count); ModelStateDictionary wrapper3 = new ModelStateDictionary(); AdvancedSearch search3 = new AdvancedSearch(); search3.ToSQL("Document/whereas/id/eq/10/Orderby/title/count", "1", wrapper3); Assert.AreEqual(1, wrapper3.Count); }
public void TransformSQLUnknownResource() { ModelStateDictionary wrapper = new ModelStateDictionary(); AdvancedSearch search = new AdvancedSearch(); search.ToSQL("unknownresource/where/id/eq/10", "1", wrapper); Assert.AreEqual(1, wrapper.Count); }
public void TransformSQLUnknownKeyWord() { ModelStateDictionary wrapper = new ModelStateDictionary(); AdvancedSearch search = new AdvancedSearch(); search.ToSQL("Document/whereas/id/eq/10", "1", wrapper); Assert.AreEqual(1, wrapper.Count); ModelStateDictionary wrapper2 = new ModelStateDictionary(); AdvancedSearch search2 = new AdvancedSearch(); search2.ToSQL("Document/where/id/eq/10/ora/id/eq/15", "1", wrapper2); Assert.AreEqual(1, wrapper2.Count); }
public void TransformSQLRandom() { ModelStateDictionary wrapper = new ModelStateDictionary(); AdvancedSearch search = new AdvancedSearch(); search.ToSQL("fpefpoeà)orfàfioefsdfvkpoejkfge", "1", wrapper); Assert.AreEqual(1, wrapper.Count); }
public void TransformSQLEmpty() { ModelStateDictionary wrapper = new ModelStateDictionary(); AdvancedSearch search1 = new AdvancedSearch(); search1.ToSQL("", "1", wrapper); Assert.AreEqual(1, wrapper.Count); ModelStateDictionary wrapper2 = new ModelStateDictionary(); AdvancedSearch search2 = new AdvancedSearch(); search2.ToSQL(null, "1", wrapper2); Assert.AreEqual(1, wrapper2.Count); }
public void TransformSQLLimitNegativeNumber() { ModelStateDictionary wrapper = new ModelStateDictionary(); AdvancedSearch search1 = new AdvancedSearch(); search1.ToSQL("Document/limit/-1/10", "1", wrapper); Assert.AreEqual(1, wrapper.Count); ModelStateDictionary wrapper2 = new ModelStateDictionary(); AdvancedSearch search2 = new AdvancedSearch(); search2.ToSQL("Document/limit/-1/-1", "1", wrapper2); Assert.AreEqual(1, wrapper2.Count); ModelStateDictionary wrapper3 = new ModelStateDictionary(); AdvancedSearch search3 = new AdvancedSearch(); search3.ToSQL("Document/limit/1/-1", "1", wrapper3); Assert.AreEqual(1, wrapper3.Count); ModelStateDictionary wrapper4 = new ModelStateDictionary(); AdvancedSearch search4 = new AdvancedSearch(); search4.ToSQL("Document/limit/1/0", "1", wrapper4); Assert.AreEqual(1, wrapper4.Count); ModelStateDictionary wrapper5 = new ModelStateDictionary(); AdvancedSearch search5 = new AdvancedSearch(); search5.ToSQL("Document/limit/0", "1", wrapper5); Assert.AreEqual(1, wrapper5.Count); ModelStateDictionary wrapper6 = new ModelStateDictionary(); AdvancedSearch search6 = new AdvancedSearch(); search6.ToSQL("Document/limit/0/-1", "1", wrapper6); Assert.AreEqual(1, wrapper6.Count); }
public void TransformSQLLimitWithOffset() { ModelStateDictionary wrapper = new ModelStateDictionary(); AdvancedSearch search = new AdvancedSearch(); search.ToSQL("Document/limit/5/10", "1", wrapper); TestInfo(search.Infos, new SearchInfos() { count = false, orderByClause = "id ascending", resource = "Document", skip = 5, take = 10, whereClause = new System.Text.StringBuilder("Home.ClientId == 1"), whereParameters = new List<object>() { } }); }
public void Init() { wrapper = new ModelStateDictionary(); search = new AdvancedSearch(); }