public void CanFindViewsByClassNameWillNotFindMismatches() { JSONModel model = PrepareModel(); IEnumerable <JToken> tokens = model.SearchJSON("NotPresent"); int count = 0; foreach (JToken token in tokens) { count++; } Assert.AreEqual(0, count); }
public bool Process(string input) { if (input == "x") { controller.SubProcessingComplete(); return(false); } else if (input == "ex") { PrintExamples(); return(false); } else { IEnumerable <JToken> results = null; try { results = model.SearchJSON(input); } catch (Exception e) { Console.WriteLine(e.ToString()); } int count = 0; if (results != null) { foreach (JToken token in results) { Console.WriteLine(token.ToString()); Console.WriteLine("------------------------"); count++; } } Console.WriteLine(string.Format("{0} results", count)); return(false); } }
public void CanFindViewsByClassName() { JSONModel model = PrepareModel(); IEnumerable <JToken> tokens = model.SearchJSON("Input"); int count = 0; JToken first = null; foreach (JToken token in tokens) { if (count == 0) { first = token; } count++; } Assert.AreEqual(26, count); string expectedString = LoadTestStringFromFile("../../first_class_input.json"); Assert.AreEqual(expectedString, first.ToString()); }
public void CanFindViewsByIdentifier() { JSONModel model = PrepareModel(); IEnumerable <JToken> tokens = model.SearchJSON("Button#apply"); int count = 0; JToken first = null; foreach (JToken token in tokens) { if (count == 0) { first = token; } count++; } Assert.AreEqual(1, count); string expectedString = LoadTestStringFromFile("../../button_apply.json"); Assert.AreEqual(expectedString, first.ToString()); }