summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Xaml.UnitTests/XamlC/PropertyDefinitionExtensionsTests.cs
diff options
context:
space:
mode:
authorJason Smith <jason.smith@xamarin.com>2016-03-22 13:02:25 -0700
committerJason Smith <jason.smith@xamarin.com>2016-03-22 16:13:41 -0700
commit17fdde66d94155fc62a034fa6658995bef6fd6e5 (patch)
treeb5e5073a2a7b15cdbe826faa5c763e270a505729 /Xamarin.Forms.Xaml.UnitTests/XamlC/PropertyDefinitionExtensionsTests.cs
downloadxamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.tar.gz
xamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.tar.bz2
xamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.zip
Initial import
Diffstat (limited to 'Xamarin.Forms.Xaml.UnitTests/XamlC/PropertyDefinitionExtensionsTests.cs')
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/XamlC/PropertyDefinitionExtensionsTests.cs75
1 files changed, 75 insertions, 0 deletions
diff --git a/Xamarin.Forms.Xaml.UnitTests/XamlC/PropertyDefinitionExtensionsTests.cs b/Xamarin.Forms.Xaml.UnitTests/XamlC/PropertyDefinitionExtensionsTests.cs
new file mode 100644
index 00000000..b43e4c9d
--- /dev/null
+++ b/Xamarin.Forms.Xaml.UnitTests/XamlC/PropertyDefinitionExtensionsTests.cs
@@ -0,0 +1,75 @@
+using System;
+using System.Linq;
+
+using Mono.Cecil;
+
+using Xamarin.Forms.Build.Tasks;
+
+using NUnit.Framework;
+
+namespace Xamarin.Forms.Xaml.XamlcUnitTests
+{
+ [TestFixture]
+ public class PropertyDefinitionExtensionsTests
+ {
+ public class NonGenericClass
+ {
+ public object Property { get; set; }
+ }
+
+ public class GenericClass<T>
+ {
+ public object Property { get; set; }
+ public T GenericProperty { get; set; }
+ }
+
+ ModuleDefinition module;
+
+ [SetUp]
+ public void SetUp ()
+ {
+ module = ModuleDefinition.CreateModule ("foo", ModuleKind.Dll);
+ }
+
+// [Test]
+// public void ResolveGenericsOnNonGenericPreserveAccessors ()
+// {
+// var type = module.Import (typeof (NonGenericClass));
+// TypeReference declaringTypeReference;
+// PropertyDefinition prop = type.GetProperty (fd => fd.Name == "Property", out declaringTypeReference);
+// Assert.AreEqual ("System.Object", prop.PropertyType.FullName);
+// Assert.AreEqual ("System.Void Xamarin.Forms.Xaml.XamlcUnitTests.PropertyDefinitionExtensionsTests/NonGenericClass::set_Property(System.Object)", prop.SetMethod.FullName);
+// Assert.AreEqual ("System.Object Xamarin.Forms.Xaml.XamlcUnitTests.PropertyDefinitionExtensionsTests/NonGenericClass::get_Property()", prop.GetMethod.FullName);
+// Assert.AreEqual ("Xamarin.Forms.Xaml.XamlcUnitTests.PropertyDefinitionExtensionsTests/NonGenericClass", prop.DeclaringType.FullName);
+//
+// prop.ResolveGenericParameters (declaringTypeReference);
+//
+// Assert.AreEqual ("System.Object", prop.PropertyType.FullName);
+// Assert.AreEqual ("System.Void Xamarin.Forms.Xaml.XamlcUnitTests.PropertyDefinitionExtensionsTests/NonGenericClass::set_Property(System.Object)", prop.SetMethod.FullName);
+// Assert.AreEqual ("System.Object Xamarin.Forms.Xaml.XamlcUnitTests.PropertyDefinitionExtensionsTests/NonGenericClass::get_Property()", prop.GetMethod.FullName);
+// Assert.AreEqual ("Xamarin.Forms.Xaml.XamlcUnitTests.PropertyDefinitionExtensionsTests/NonGenericClass", prop.DeclaringType.FullName);
+//
+// }
+//
+// [Test]
+// public void NonGenericPropertyOnGenericType ()
+// {
+// var type = module.Import (typeof (GenericClass<bool>));
+// TypeReference declaringTypeReference;
+// PropertyDefinition prop = type.GetProperty (fd => fd.Name == "Property", out declaringTypeReference);
+// Assert.AreEqual ("System.Object", prop.PropertyType.FullName);
+// Assert.AreEqual ("System.Void Xamarin.Forms.Xaml.XamlcUnitTests.PropertyDefinitionExtensionsTests/GenericClass`1::set_Property(System.Object)", prop.SetMethod.FullName);
+// Assert.AreEqual ("System.Object Xamarin.Forms.Xaml.XamlcUnitTests.PropertyDefinitionExtensionsTests/GenericClass`1::get_Property()", prop.GetMethod.FullName);
+// Assert.AreEqual ("Xamarin.Forms.Xaml.XamlcUnitTests.PropertyDefinitionExtensionsTests/GenericClass`1", prop.DeclaringType.FullName);
+// Assert.False (prop.DeclaringType.IsGenericInstance);
+//
+// prop.ResolveGenericParameters (declaringTypeReference);
+// Assert.AreEqual ("System.Object", prop.PropertyType.FullName);
+// Assert.AreEqual ("System.Void Xamarin.Forms.Xaml.XamlcUnitTests.PropertyDefinitionExtensionsTests/GenericClass`1::set_Property(System.Object)", prop.SetMethod.FullName);
+// Assert.AreEqual ("System.Object Xamarin.Forms.Xaml.XamlcUnitTests.PropertyDefinitionExtensionsTests/GenericClass`1::get_Property()", prop.GetMethod.FullName);
+// Assert.AreEqual ("Xamarin.Forms.Xaml.XamlcUnitTests.PropertyDefinitionExtensionsTests/GenericClass`1", prop.DeclaringType.FullName);
+// Assert.True (prop.DeclaringType.IsGenericInstance);
+//
+// }
+ }
+} \ No newline at end of file