diff options
Diffstat (limited to 'Xamarin.Forms.UITest.TestCloud/LoaderActions.cs')
-rw-r--r-- | Xamarin.Forms.UITest.TestCloud/LoaderActions.cs | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/Xamarin.Forms.UITest.TestCloud/LoaderActions.cs b/Xamarin.Forms.UITest.TestCloud/LoaderActions.cs new file mode 100644 index 00000000..93edee2b --- /dev/null +++ b/Xamarin.Forms.UITest.TestCloud/LoaderActions.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Xamarin.Forms.Loader; + +namespace Xamarin.Forms.UITest.TestCloud +{ + internal class LoaderActions + { + readonly IEnumerable<string> _testCategories; + + public LoaderActions() + { + var formsLoader = new FormsLoader(); + + var categoriesOnTypes = + from type in formsLoader.IOSTestTypes() + from categoryAttribute in type.Categories() + select categoryAttribute.Name; + + var categoriesOnMembers = + from type in formsLoader.IOSTestTypes() + from members in type.Members() + from categoryAttribute in members.CategoryAttributes() + select categoryAttribute.Name; + + _testCategories = categoriesOnTypes.Union(categoriesOnMembers); + } + + public void ListCategories() + { + foreach (string category in _testCategories) + Console.WriteLine(category); + } + + public bool ValidateCategory(string category) + { + return _testCategories.Any(k => k == category) || category == "All"; + } + } +}
\ No newline at end of file |