using System; using NUnit.Framework; using Mono.Cecil; using Xamarin.Forms.Build.Tasks; using System.Collections.Generic; namespace Xamarin.Forms { public class Effect { } } namespace Xamarin.Forms.Xaml.XamlcUnitTests { [TestFixture] public class TypeReferenceExtensionsTests { class Foo { } class Foo : Foo { } class Bar : Foo { } ModuleDefinition module; [SetUp] public void SetUp() { var resolver = new XamlCAssemblyResolver(); resolver.AddAssembly(Uri.UnescapeDataString((new UriBuilder(typeof(TypeReferenceExtensionsTests).Assembly.CodeBase)).Path)); resolver.AddAssembly(Uri.UnescapeDataString((new UriBuilder(typeof(BindableObject).Assembly.CodeBase)).Path)); resolver.AddAssembly(Uri.UnescapeDataString((new UriBuilder(typeof(object).Assembly.CodeBase)).Path)); resolver.AddAssembly(Uri.UnescapeDataString((new UriBuilder(typeof(IList<>).Assembly.CodeBase)).Path)); resolver.AddAssembly(Uri.UnescapeDataString((new UriBuilder(typeof(Queue<>).Assembly.CodeBase)).Path)); module = ModuleDefinition.CreateModule("foo", new ModuleParameters { AssemblyResolver = resolver, Kind = ModuleKind.NetModule }); } [TestCase(typeof(bool), typeof(BindableObject), ExpectedResult = false)] [TestCase(typeof(Dictionary), typeof(BindableObject), ExpectedResult = false)] [TestCase(typeof(List), typeof(BindableObject), ExpectedResult = false)] [TestCase(typeof(List), typeof(IEnumerable), ExpectedResult = true)] [TestCase(typeof(List