public void ParseInputTest(string str, string[] expected) { var result = TreeConstructor.ParseInput(str); Assert.Equal(expected[0], result[0]); Assert.Equal(expected[1], result[1]); }
public void CheckTest(string op, int count, bool expected) { Dictionary <string, int> targetDictionary = new Dictionary <string, int>(); targetDictionary.Add("1", 1); targetDictionary.Add("2", 1); targetDictionary.Add("7", 1); var result = TreeConstructor.Check(op, targetDictionary, count); Assert.Equal(expected, result); }
/// <summary> /// Поиск всех эл-тов в дереве по заданному условию /// </summary> /// <param name="tree"></param> /// <param name="check"></param> /// <param name="constructor"></param> /// <returns></returns> public static ITree <T> FindAll(ITree <T> tree, CheckDelegate <T> check, TreeConstructor <T> constructor) { ITree <T> res = constructor(); foreach (T ob in tree) { if (check(ob)) { res.Add(ob); } } return(res); }
public virtual IFluentPathElement ResolveResource(string url) { if (FhirClient == null) { throw Error.InvalidOperation("The EvaluationContext does not have a FhirClient to use to resolve url '{0}'".FormatWith(url)); } try { var resource = FhirClient.Get(url); if (resource == null) { return(null); } var xml = FhirSerializer.SerializeResourceToXml(resource); return(TreeConstructor.FromXml(xml)); } catch (Exception e) { throw e; //return null; } }
void Awake() { if (inst == null) inst = this; }
public void ServiceTest(string expected, string[] strArr) { var result = TreeConstructor.CreateTree(strArr); Assert.Equal(expected, result); }
private void _DivideByZero() { var tree = TreeConstructor.CreateTree("(/ 2 0)"); tree.Calculate(); }
public int TreeCanCalculateSimpleExpression(string input) { var tree = TreeConstructor.CreateTree(input); return(tree.Calculate()); }