Ejemplo n.º 1
0
        public void ParseInputTest(string str, string[] expected)
        {
            var result = TreeConstructor.ParseInput(str);

            Assert.Equal(expected[0], result[0]);
            Assert.Equal(expected[1], result[1]);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        /// <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);
        }
Ejemplo n.º 4
0
        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;
 }
Ejemplo n.º 6
0
        public void ServiceTest(string expected, string[] strArr)
        {
            var result = TreeConstructor.CreateTree(strArr);

            Assert.Equal(expected, result);
        }
Ejemplo n.º 7
0
        private void _DivideByZero()
        {
            var tree = TreeConstructor.CreateTree("(/ 2 0)");

            tree.Calculate();
        }
Ejemplo n.º 8
0
        public int TreeCanCalculateSimpleExpression(string input)
        {
            var tree = TreeConstructor.CreateTree(input);

            return(tree.Calculate());
        }