summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Loader/FormsLoader.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Loader/FormsLoader.cs')
-rw-r--r--Xamarin.Forms.Loader/FormsLoader.cs51
1 files changed, 51 insertions, 0 deletions
diff --git a/Xamarin.Forms.Loader/FormsLoader.cs b/Xamarin.Forms.Loader/FormsLoader.cs
new file mode 100644
index 00000000..d6826830
--- /dev/null
+++ b/Xamarin.Forms.Loader/FormsLoader.cs
@@ -0,0 +1,51 @@
+´╗┐using System.Collections.Generic;
+using System.Linq;
+using Xamarin.Forms.Core.UITests;
+
+namespace Xamarin.Forms.Loader
+{
+ internal sealed class FormsLoader
+ {
+ static IEnumerable<FormsType> formsTypes;
+ static IEnumerable<TestType> iOSTestTypes;
+ static IEnumerable<TestType> androidTestTypes;
+
+ public FormsLoader()
+ {
+ var formsCoreAssembly = typeof (View).Assembly;
+ var iOSUITestAssembly = typeof (iOSLoaderIdentifier).Assembly;
+ var androidUITestAssembly = typeof (AndroidLoaderIdentifier).Assembly;
+
+ // skip interfaces, delegates, classes that inherit from attribute
+ formsTypes =
+ from o in formsCoreAssembly.GetTypes()
+ where o.IsVisible && o.IsClass && !o.IsDelegate() && !o.InheritsFromAttribute() && !o.InheritsFromException()
+ select new FormsType(this, o);
+
+ iOSTestTypes =
+ from o in iOSUITestAssembly.GetTypes()
+ where o.IsTestFixture() && o.HasCategoryAttribute()
+ select new TestType(this, o);
+
+ androidTestTypes =
+ from o in androidUITestAssembly.GetTypes()
+ where o.IsTestFixture() && o.HasCategoryAttribute()
+ select new TestType(this, o);
+ }
+
+ public IEnumerable<FormsType> FormsTypes()
+ {
+ return formsTypes;
+ }
+
+ public IEnumerable<TestType> IOSTestTypes()
+ {
+ return iOSTestTypes;
+ }
+
+ public IEnumerable<TestType> AndroidTestTypes()
+ {
+ return androidTestTypes;
+ }
+ }
+} \ No newline at end of file