Exemplo n.º 1
0
        public TestContextFactory(string rootDirectory, ITestDataProvider testDataProvider)
        {
            this.rootDirectory    = rootDirectory;
            this.testDataProvider = testDataProvider;

            testDataProvider.LoadDefinitions();
        }
Exemplo n.º 2
0
        public override IEnumerable <object[]> GetData(MethodInfo testMethod)
        {
            if (testMethod == null)
            {
                throw new ArgumentNullException(nameof(testMethod));
            }

            testDataProvider.LoadDefinitions();

            List <object[]> categoryTests = new List <object[]>();

            foreach (TestCategoryDefinition category in testDataProvider.GetCategories())
            {
                if (!string.IsNullOrEmpty(category?.Name))
                {
                    foreach (TestDefinition test in category.Tests)
                    {
                        if (!string.IsNullOrEmpty(test.Name))
                        {
                            categoryTests.Add(new object[] { category.Name, test.Name });
                        }
                    }
                }
            }

            return(categoryTests);
        }