Exemple #1
0
        public static SelectTestDefinition[] GetSelectTestDefinitions()
        {
            var fixture    = new SelectTestDefinitionFixture();
            var selectTest = new SelectTest(fixture);

            var methodNames = new List <String>();

            foreach (MethodInfo methodInfo in selectTest.GetType().GetMethods().Where(m => m.GetCustomAttributes(typeof(FactAttribute), false).Count() == 1))
            {
                methodNames.Add(methodInfo.Name);
                var testMethod = (Func <SelectTest, Task>)methodInfo.CreateDelegate(typeof(Func <SelectTest, Task>));
                testMethod(selectTest).GetAwaiter().GetResult();
            }

            for (int i = 0; i < methodNames.Count; i++)
            {
                fixture.SelectTestDefinitions[i].MethodName = methodNames[i];
            }
            return(fixture.SelectTestDefinitions.ToArray());
        }
        public static SelectTestDefinition[] GetSelectTestDefinitions()
        {
            var fixture    = new SelectTestDefinitionFixture();
            var selectTest = new SelectTest(fixture);

            var methodNames = new List <String>();

            foreach (MethodInfo methodInfo in selectTest.GetType().GetMethods().Where(m => m.GetCustomAttributes(typeof(FactAttribute), false).Count() == 1))
            {
                Func <SelectTest, Task> testMethod;
                var factAttribute = (FactAttribute)methodInfo.GetCustomAttribute(typeof(FactAttribute), false);
                if (factAttribute is TheoryAttribute)
                {
                    var methodCall = (Func <SelectTest, bool, Task>)methodInfo.CreateDelegate(typeof(Func <SelectTest, bool, Task>));
                    testMethod = i => methodCall(i, false);
                }
                else if (factAttribute is FactAttribute)
                {
                    testMethod = (Func <SelectTest, Task>)methodInfo.CreateDelegate(typeof(Func <SelectTest, Task>));
                }
                else
                {
                    continue;
                }

                int count = fixture.SelectTestDefinitions.Count;
                testMethod(selectTest).GetAwaiter().GetResult();
                if (fixture.SelectTestDefinitions.Count == count)
                {
                    continue;
                }

                methodNames.Add(methodInfo.Name);
            }

            for (int i = 0; i < methodNames.Count; i++)
            {
                fixture.SelectTestDefinitions[i].MethodName = methodNames[i];
            }
            return(fixture.SelectTestDefinitions.ToArray());
        }
 public async Task Count()
 {
     String request = "Orders?$expand=Items($count=true)&$count=true";
     await SelectTest.OrdersCountItemsCount(Fixture, request, i => true, 0, false);
 }