Exemple #1
0
        public IHttpActionResult Tests()
        {
            EntityFrameworkExecutionTests.Init();

            var ef = new EntityFrameworkExecutionTests();

            var methods = ef.GetType()
                          .GetMethods()
                          .Where(m => m.GetCustomAttributes(typeof(TestAttribute), true).Any())
                          .Select(m => new { m.Name, Exec = (bool)m.Invoke(ef, null) })
                          .ToList();

            var tests = methods.GroupBy(n => n.Exec);

            return(Ok(tests));
        }
Exemple #2
0
        // GET api/values
        public async Task <object> Get()
        {
            var input = await Request.Content.ReadAsStringAsync();

            string query = Regex.Unescape(input).Replace("\n", string.Empty);

            query = query.Replace(@"\", string.Empty);

            var j = JObject.Parse(query);

            var qs = j["query"].ToString();

            //var q2 = qs.Substring(1, qs.Length - 2).Trim();

            var regex = new Regex("{query:(.*)}");

            var q = regex.Match(query).Groups[1].ToString();

            EntityFrameworkExecutionTests.Init();

            /*
             * var ef = new EntityFrameworkExecutionTests();
             *
             * var methods = ef.GetType()
             *  .GetMethods()
             *  .Where(m => m.GetCustomAttributes(typeof(TestAttribute), true).Any())
             *  .Select(m => new { m.Name, Exec = (bool)m.Invoke(ef, null) })
             *  .ToList();
             *
             * var tests = methods.GroupBy(n => n.Exec);
             */

            var context = EntityFrameworkExecutionTests.CreateDefaultContext();

            var result = context.ExecuteQuery(qs);

            return(result);
        }