Ejemplo n.º 1
0
        public void ContentPageWithMissingClass()
        {
            var xaml = @"
				<ContentPage xmlns=""http://xamarin.com/schemas/2014/forms""
					xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml""
					x:Class=""Microsoft.Maui.Controls.Xaml.UnitTests.CustomView""
				/>"                ;

            Assert.That(XamlLoader.Create(xaml, true), Is.TypeOf <ContentPage>());
        }
Ejemplo n.º 2
0
        public void ViewWithMissingClass()
        {
            var xaml = @"
				<ContentView xmlns=""http://schemas.microsoft.com/dotnet/2021/maui""
					xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml""
					x:Class=""Microsoft.Maui.Controls.Xaml.UnitTests.CustomView""
				/>"                ;

            Assert.That(XamlLoader.Create(xaml, true), Is.TypeOf <ContentView>());
        }
Ejemplo n.º 3
0
        public void CreateFromXamlDoesntFailOnMissingEventHandler()
        {
            var xaml = @"
				<Button xmlns=""http://xamarin.com/schemas/2014/forms""
						xmlns:x=""http://schemas.microsoft.com/winfx/2009/xaml""
						Clicked=""handleClick"">
				</Button>"                ;

            Button button = null;

            Assert.DoesNotThrow(() => button = XamlLoader.Create(xaml, true) as Button);
            Assert.NotNull(button);
        }
Ejemplo n.º 4
0
        public void UnknownMarkupExtensionOnMissingType()
        {
            XamlLoader.FallbackTypeResolver = (p, type) => type ?? typeof(MockView);

            var xaml = @"
				<ContentPage xmlns=""http://xamarin.com/schemas/2014/forms""
					xmlns:local=""clr-namespace:MissingNamespace;assembly=MissingAssembly"">
					<local:MyCustomButton Bar=""{local:Foo}"" />
				</ContentPage>"                ;

            var page = (ContentPage)XamlLoader.Create(xaml, true);

            Assert.That(page.Content, Is.TypeOf <MockView>());
        }
Ejemplo n.º 5
0
        public void CreateFromXaml()
        {
            var xaml = @"
				<ContentView xmlns=""http://xamarin.com/schemas/2014/forms""
							 xmlns:x=""http://schemas.microsoft.com/winfx/2009/xaml""
						     x:Class=""Xamarin.Forms.Xaml.UnitTests.FOO"">
					<Label Text=""Foo""  x:Name=""label""/>
				</ContentView>"                ;

            var view = XamlLoader.Create(xaml);

            Assert.That(view, Is.TypeOf <ContentView> ());
            Assert.AreEqual("Foo", ((Label)((ContentView)view).Content).Text);
        }
        public void IgnoreMarkupExtensionException()
        {
            var xaml = @"
						<ContentPage xmlns=""http://xamarin.com/schemas/2014/forms""
							xmlns:x=""http://schemas.microsoft.com/winfx/2009/xaml"">
							<ListView ItemsSource=""{x:Static Foo}"" />
						</ContentPage>"                        ;

            var exceptions = new List <Exception>();

            Xamarin.Forms.Internals.ResourceLoader.ExceptionHandler = exceptions.Add;
            Assert.DoesNotThrow(() => XamlLoader.Create(xaml, true));
            Assert.That(exceptions.Count, Is.GreaterThan(1));
        }
Ejemplo n.º 7
0
        public void UnknownGenericType()
        {
            XamlLoader.FallbackTypeResolver = (p, type) => type ?? typeof(MockView);

            var xaml = @"
				<ContentPage xmlns=""http://xamarin.com/schemas/2014/forms""
					xmlns:local=""clr-namespace:MissingNamespace;assembly=MissingAssembly""
					xmlns:x=""http://schemas.microsoft.com/winfx/2009/xaml"">
					<local:MyCustomButton x:TypeArguments=""local:MyCustomType"" />
				 </ContentPage>"                ;

            var page = (ContentPage)XamlLoader.Create(xaml, true);

            Assert.That(page.Content, Is.TypeOf <MockView>());
        }
Ejemplo n.º 8
0
        public void CanIgnoreSettingPropertyThatThrows()
        {
            var xaml = @"
					<ContentPage xmlns=""http://xamarin.com/schemas/2014/forms""
						xmlns:x=""http://schemas.microsoft.com/winfx/2009/xaml""
						xmlns:local=""clr-namespace:Xamarin.Forms.Xaml.UnitTests;assembly=Xamarin.Forms.Xaml.UnitTests"">
						<local:SettingPropertyThrows TestValue=""Test"" TestBP=""bar""/>
					</ContentPage>"                    ;

            var exceptions = new List <Exception>();

            Xamarin.Forms.Internals.ResourceLoader.ExceptionHandler = exceptions.Add;
            Assert.DoesNotThrow(() => XamlLoader.Create(xaml, true));
            Assert.That(exceptions.Count, Is.EqualTo(2));
        }
Ejemplo n.º 9
0
        public void IgnoreConverterException()
        {
            var xaml = @"
					<ContentPage xmlns=""http://xamarin.com/schemas/2014/forms""
						xmlns:x=""http://schemas.microsoft.com/winfx/2009/xaml""
						xmlns:local=""clr-namespace:Xamarin.Forms.Xaml.UnitTests;assembly=Xamarin.Forms.Xaml.UnitTests"">
						<Label BackgroundColor=""AlmostPink"" />
					</ContentPage>"                    ;

            var exceptions = new List <Exception>();

            Xamarin.Forms.Internals.ResourceLoader.ExceptionHandler = exceptions.Add;
            Assert.DoesNotThrow(() => XamlLoader.Create(xaml, true));
            Assert.That(exceptions.Count, Is.EqualTo(1));
        }
Ejemplo n.º 10
0
        public void CanProvideInstanceWhenReplacedTypeConstructorInvalid()
        {
            var xaml = @"
						<ContentPage xmlns=""http://xamarin.com/schemas/2014/forms""
							xmlns:x=""http://schemas.microsoft.com/winfx/2009/xaml""
							xmlns:local=""clr-namespace:Microsoft.Maui.Controls.Xaml.UnitTests;assembly=Microsoft.Maui.Controls.Xaml.UnitTests"">
							<StackLayout>
								<local:ReplacedType x:FactoryMethod=""CreateInstance"" />
							</StackLayout>
						</ContentPage>"                        ;

            XamlLoader.FallbackTypeResolver        = (p, type) => type ?? typeof(Button);
            XamlLoader.InstantiationFailedCallback = (xmltype, type, exception) => new Button();
            Assert.DoesNotThrow(() => XamlLoader.Create(xaml, true));
        }
Ejemplo n.º 11
0
        public void UnknownMarkupExtensionKnownType()
        {
            XamlLoader.FallbackTypeResolver = (p, type) => type ?? typeof(MockView);

            var xaml = @"
				<ContentPage xmlns=""http://schemas.microsoft.com/dotnet/2021/maui""
					xmlns:x=""http://schemas.microsoft.com/winfx/2009/xaml""
					xmlns:local=""clr-namespace:MissingNamespace;assembly=MissingAssembly"">
					<Button Text=""{local:Foo}"" />
				</ContentPage>"                ;

            var page = (ContentPage)XamlLoader.Create(xaml, true);

            Assert.That(page.Content, Is.TypeOf <Button>());
        }
Ejemplo n.º 12
0
        public void MissingGenericRootTypeProvidesCorrectTypeName()
        {
            var xaml = @"
					<local:GenericContentPage xmlns=""http://xamarin.com/schemas/2014/forms""
						xmlns:x=""http://schemas.microsoft.com/winfx/2009/xaml""
						xmlns:local=""clr-namespace:MissingNamespace""
						x:TypeArguments=""x:Object"" />"                        ;

            XamlLoader.FallbackTypeResolver = (p, type) =>
            {
                Assert.That(p.Select(i => i.TypeName), Has.Some.EqualTo("GenericContentPage`1"));
                return(typeof(ContentPage));
            };

            Assert.DoesNotThrow(() => XamlLoader.Create(xaml, true));
        }
Ejemplo n.º 13
0
        public void StaticResourceKeyNotFound()
        {
            var xaml = @"
				<ContentPage xmlns=""http://xamarin.com/schemas/2014/forms"">
					<Button Style=""{StaticResource MissingStyle}"" />
				</ContentPage>"                ;

            var exceptions = new List <Exception>();

            Xamarin.Forms.Internals.ResourceLoader.ExceptionHandler = exceptions.Add;

            var page = (ContentPage)XamlLoader.Create(xaml, true);

            Assert.That(page.Content, Is.TypeOf <Button>());
            Assert.That(exceptions.Count, Is.EqualTo(2));
        }
Ejemplo n.º 14
0
        public void UnknownGenericType()
        {
            XamlLoader.FallbackTypeResolver = (p, type) => type ??
                                              (p.Any(i => i.TypeName == "MyCustomButton`1") ? typeof(ProxyGenericButton <>) : typeof(MockView));

            var xaml = @"
				<ContentPage xmlns=""http://schemas.microsoft.com/dotnet/2021/maui""
					xmlns:local=""clr-namespace:MissingNamespace;assembly=MissingAssembly""
					xmlns:x=""http://schemas.microsoft.com/winfx/2009/xaml"">
					<local:MyCustomButton x:TypeArguments=""local:MyCustomType"" />
				 </ContentPage>"                ;

            var page = (ContentPage)XamlLoader.Create(xaml, true);

            Assert.That(page.Content, Is.TypeOf <ProxyGenericButton <MockView> >());
        }
Ejemplo n.º 15
0
        public void IgnoreFindByNameInvalidCastException()
        {
            var xaml = @"
						<ContentPage xmlns=""http://xamarin.com/schemas/2014/forms""
							xmlns:x=""http://schemas.microsoft.com/winfx/2009/xaml"">
							<Label x:Name=""MyName"" />
						</ContentPage>"                        ;

            var exceptions = new List <Exception>();

            Xamarin.Forms.Internals.ResourceLoader.ExceptionHandler = exceptions.Add;
            var content = (ContentPage)XamlLoader.Create(xaml, true);

            Assert.DoesNotThrow(() => content.FindByName <Button>("MyName"));
            Assert.That(exceptions.Count, Is.GreaterThanOrEqualTo(1));
        }
Ejemplo n.º 16
0
        public void IgnoreConverterException()
        {
            var xaml = @"
					<ContentPage xmlns=""http://schemas.microsoft.com/dotnet/2021/maui""
						xmlns:x=""http://schemas.microsoft.com/winfx/2009/xaml""
						xmlns:local=""clr-namespace:Microsoft.Maui.Controls.Xaml.UnitTests;assembly=Microsoft.Maui.Controls.Xaml.UnitTests"">
						<Label BackgroundColor=""AlmostPink"" />
					</ContentPage>"                    ;

            var exceptions = new List <Exception>();

#pragma warning disable CS0618 // Type or member is obsolete
            Microsoft.Maui.Controls.Internals.ResourceLoader.ExceptionHandler = exceptions.Add;
#pragma warning restore CS0618 // Type or member is obsolete
            Assert.DoesNotThrow(() => XamlLoader.Create(xaml, true));
            Assert.That(exceptions.Count, Is.EqualTo(1));
        }
Ejemplo n.º 17
0
        public void CanIgnoreSettingPropertyThatThrows()
        {
            var xaml = @"
					<ContentPage xmlns=""http://schemas.microsoft.com/dotnet/2021/maui""
						xmlns:x=""http://schemas.microsoft.com/winfx/2009/xaml""
						xmlns:local=""clr-namespace:Microsoft.Maui.Controls.Xaml.UnitTests;assembly=Microsoft.Maui.Controls.Xaml.UnitTests"">
						<local:SettingPropertyThrows TestValue=""Test"" TestBP=""bar""/>
					</ContentPage>"                    ;

            var exceptions = new List <Exception>();

#pragma warning disable CS0618 // Type or member is obsolete
            Microsoft.Maui.Controls.Internals.ResourceLoader.ExceptionHandler = exceptions.Add;
#pragma warning restore CS0618 // Type or member is obsolete
            Assert.DoesNotThrow(() => XamlLoader.Create(xaml, true));
            Assert.That(exceptions.Count, Is.EqualTo(2));
        }
Ejemplo n.º 18
0
        public void IgnoreFindByNameInvalidCastException()
        {
            var xaml = @"
						<ContentPage xmlns=""http://schemas.microsoft.com/dotnet/2021/maui""
							xmlns:x=""http://schemas.microsoft.com/winfx/2009/xaml"">
							<Label x:Name=""MyName"" />
						</ContentPage>"                        ;

            var exceptions = new List <Exception>();

#pragma warning disable CS0618 // Type or member is obsolete
            Microsoft.Maui.Controls.Internals.ResourceLoader.ExceptionHandler = exceptions.Add;
#pragma warning restore CS0618 // Type or member is obsolete
            var content = (ContentPage)XamlLoader.Create(xaml, true);
            Assert.DoesNotThrow(() => content.FindByName <Button>("MyName"));
            Assert.That(exceptions.Count, Is.GreaterThanOrEqualTo(1));
        }
Ejemplo n.º 19
0
        public void ContentPageWithMissingTypeMockviewReplacement()
        {
            XamlLoader.FallbackTypeResolver = (p, type) => type ?? typeof(MockView);

            var xaml = @"
				<ContentPage xmlns=""http://schemas.microsoft.com/dotnet/2021/maui""
					xmlns:local=""clr-namespace:MissingNamespace;assembly=MissingAssembly""
					xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml"">
					<ContentPage.Content>
						<local:MyCustomButton />
					</ContentPage.Content>
				</ContentPage>"                ;

            var page = (ContentPage)XamlLoader.Create(xaml, true);

            Assert.That(page.Content, Is.TypeOf <MockView>());
        }
Ejemplo n.º 20
0
        public void StaticResourceKeyNotFound()
        {
            var xaml = @"
				<ContentPage xmlns=""http://xamarin.com/schemas/2014/forms"">
					<Button Style=""{StaticResource MissingStyle}"" />
				</ContentPage>"                ;

            var exceptions = new List <Exception>();

#pragma warning disable CS0618 // Type or member is obsolete
            Microsoft.Maui.Controls.Internals.ResourceLoader.ExceptionHandler = exceptions.Add;
#pragma warning restore CS0618 // Type or member is obsolete

            var page = (ContentPage)XamlLoader.Create(xaml, true);
            Assert.That(page.Content, Is.TypeOf <Button>());
            Assert.That(exceptions.Count, Is.EqualTo(2));
        }
Ejemplo n.º 21
0
        public void IgnoreNamedMissingTypeException()
        {
            var xaml       = @"
					<ContentPage xmlns=""http://xamarin.com/schemas/2014/forms""
						xmlns:x=""http://schemas.microsoft.com/winfx/2009/xaml""
						xmlns:local=""clr-namespace:Xamarin.Forms.Xaml.UnitTests;assembly=Xamarin.Forms.Xaml.UnitTests"">
						<StackLayout>
							<local:Missing x:Name=""MyName"" />
							<Button x:Name=""button"" />
							<Button x:Name=""button"" />
						</StackLayout>
					</ContentPage>"                    ;
            var exceptions = new List <Exception>();

            Xamarin.Forms.Internals.ResourceLoader.ExceptionHandler = exceptions.Add;
            Assert.DoesNotThrow(() => XamlLoader.Create(xaml, true));
            Assert.That(exceptions.Count, Is.GreaterThan(1));
        }
Ejemplo n.º 22
0
        public void IgnoreMarkupExtensionException()
        {
            var xaml       = @"
						<ContentPage xmlns=""http://xamarin.com/schemas/2014/forms""
							xmlns:x=""http://schemas.microsoft.com/winfx/2009/xaml""
								xmlns:local=""clr-namespace:Xamarin.Forms.Xaml.UnitTests;assembly=Xamarin.Forms.Xaml.UnitTests"">
								<StackLayout>
									<ListView ItemsSource=""{x:Static Foo}"" />
									<ListView ItemsSource=""{local:Missing Test}"" />
									<Label Text=""{Binding Foo"" />
								</StackLayout>
						</ContentPage>"                        ;
            var exceptions = new List <Exception>();

            Xamarin.Forms.Internals.ResourceLoader.ExceptionHandler = exceptions.Add;
            Assert.DoesNotThrow(() => XamlLoader.Create(xaml, true));
            Assert.That(exceptions.Count, Is.GreaterThan(1));
        }
Ejemplo n.º 23
0
        public void IgnoreMarkupExtensionException()
        {
            var xaml       = @"
						<ContentPage xmlns=""http://schemas.microsoft.com/dotnet/2021/maui""
							xmlns:x=""http://schemas.microsoft.com/winfx/2009/xaml""
								xmlns:local=""clr-namespace:Microsoft.Maui.Controls.Xaml.UnitTests;assembly=Microsoft.Maui.Controls.Xaml.UnitTests"">
								<StackLayout>
									<ListView ItemsSource=""{x:Static Foo}"" />
									<ListView ItemsSource=""{local:Missing Test}"" />
									<Label Text=""{Binding Foo"" />
								</StackLayout>
						</ContentPage>"                        ;
            var exceptions = new List <Exception>();

#pragma warning disable CS0618 // Type or member is obsolete
            Microsoft.Maui.Controls.Internals.ResourceLoader.ExceptionHandler = exceptions.Add;
#pragma warning restore CS0618 // Type or member is obsolete
            Assert.DoesNotThrow(() => XamlLoader.Create(xaml, true));
            Assert.That(exceptions.Count, Is.GreaterThan(1));
        }
Ejemplo n.º 24
0
        public void IgnoreNamedMissingTypeException()
        {
            var xaml       = @"
					<ContentPage xmlns=""http://schemas.microsoft.com/dotnet/2021/maui""
						xmlns:x=""http://schemas.microsoft.com/winfx/2009/xaml""
						xmlns:local=""clr-namespace:Microsoft.Maui.Controls.Xaml.UnitTests;assembly=Microsoft.Maui.Controls.Xaml.UnitTests"">
						<StackLayout>
							<local:Missing x:Name=""MyName"" />
							<Button x:Name=""button"" />
							<Button x:Name=""button"" />
						</StackLayout>
					</ContentPage>"                    ;
            var exceptions = new List <Exception>();

#pragma warning disable CS0618 // Type or member is obsolete
            Microsoft.Maui.Controls.Internals.ResourceLoader.ExceptionHandler = exceptions.Add;
#pragma warning restore CS0618 // Type or member is obsolete
            Assert.DoesNotThrow(() => XamlLoader.Create(xaml, true));
            Assert.That(exceptions.Count, Is.GreaterThan(1));
        }
Ejemplo n.º 25
0
        public void TextAsRandomContent()
        {
            var xaml = @"
						<ContentPage xmlns=""http://xamarin.com/schemas/2014/forms""
							xmlns:x=""http://schemas.microsoft.com/winfx/2009/xaml""
								xmlns:local=""clr-namespace:Xamarin.Forms.Xaml.UnitTests;assembly=Xamarin.Forms.Xaml.UnitTests"">
								<StackLayout>
									<Label>xyz</Label>
									<StackLayout>foo</StackLayout>
									<Label><Label.FormattedText>bar</Label.FormattedText></Label>
								</StackLayout>
						</ContentPage>"                        ;

            XamlLoader.Create(xaml, true);
            var exceptions = new List <Exception>();

            Xamarin.Forms.Internals.ResourceLoader.ExceptionHandler = exceptions.Add;
            Assert.DoesNotThrow(() => XamlLoader.Create(xaml, true));
            Assert.That(exceptions.Count, Is.GreaterThanOrEqualTo(1));
        }
Ejemplo n.º 26
0
        public void InvalidGenericType()
        {
            int exceptionCount = 0;

#pragma warning disable 0618 // Type or member is obsolete
            Maui.Controls.Internals.ResourceLoader.ExceptionHandler = _ => exceptionCount++;
            XamlLoader.FallbackTypeResolver = (p, type) => type ?? typeof(MockView);
#pragma warning restore 0618 // Type or member is obsolete

            var xaml = @"
				<ContentPage xmlns=""http://xamarin.com/schemas/2014/forms""
					xmlns:local=""clr-namespace:MissingNamespace;assembly=MissingAssembly""
					xmlns:x=""http://schemas.microsoft.com/winfx/2009/xaml"">
					<local:MyCustomButton x:TypeArguments=""local:MyCustomType"" />
				 </ContentPage>"                ;

            var page = (ContentPage)XamlLoader.Create(xaml, true);
            Assert.That(page.Content, Is.Null);
            Assert.That(exceptionCount, Is.EqualTo(1));
        }
Ejemplo n.º 27
0
        public void CssStyleTargetingRealTypeNotAppliedToMissingType()
        {
            XamlLoader.FallbackTypeResolver = (p, type) => type ?? typeof(Button);
            XamlLoader.ValueCreatedCallback = (x, v) =>
            {
                if (x.XmlTypeName == "MyCustomButton" && v is Element e)
                {
                    e._cssFallbackTypeName = "MyCustomButton";
                }
                if (x.XmlTypeName == "MyCustomButton" && v is VisualElement ve)
                {
                    ve._mergedStyle.ReRegisterImplicitStyles("MissingNamespace.MyCustomButton");
                }
            };

            var xaml = @"
				<ContentPage xmlns=""http://xamarin.com/schemas/2014/forms""
					xmlns:local=""clr-namespace:MissingNamespace;assembly=MissingAssembly"">
					<ContentPage.Resources>
						<StyleSheet>
							<![CDATA[
							button {
								background-color: red;
							}
							]]>
						</StyleSheet>
					</ContentPage.Resources>
					<StackLayout>
						<Button />
						<MyCustomButton />
					</StackLayout>
				</ContentPage>"                ;

            var page = (ContentPage)XamlLoader.Create(xaml, true);

            var button   = ((StackLayout)page.Content).Children[0];
            var myButton = ((StackLayout)page.Content).Children[1];

            Assert.That(button.BackgroundColor, Is.EqualTo(Colors.Red));
            Assert.That(myButton.BackgroundColor, Is.Not.EqualTo(Colors.Red));
        }
Ejemplo n.º 28
0
        public void ContentPageWithMissingTypeNoReplacement()
        {
            XamlLoader.FallbackTypeResolver = (p, type) => type;

            var xaml = @"
					<ContentPage xmlns=""http://xamarin.com/schemas/2014/forms""
						xmlns:local=""clr-namespace:MissingNamespace;assembly=MissingAssembly""
						xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml"">
						<ContentPage.Content>
							<local:MyCustomButton Foo=""Bar"">
								<local:MyCustomButton.Qux>
									<Label />
								</local:MyCustomButton.Qux>
							</local:MyCustomButton>
						</ContentPage.Content>
					</ContentPage>"                    ;

            var page = (ContentPage)XamlLoader.Create(xaml, true);

            Assert.That(page.Content, Is.Null);
        }
Ejemplo n.º 29
0
        public void TextAsRandomContent()
        {
            var xaml = @"
						<ContentPage xmlns=""http://schemas.microsoft.com/dotnet/2021/maui""
							xmlns:x=""http://schemas.microsoft.com/winfx/2009/xaml""
								xmlns:local=""clr-namespace:Microsoft.Maui.Controls.Xaml.UnitTests;assembly=Microsoft.Maui.Controls.Xaml.UnitTests"">
								<StackLayout>
									<Label>xyz</Label>
									<StackLayout>foo</StackLayout>
									<Label><Label.FormattedText>bar</Label.FormattedText></Label>
								</StackLayout>
						</ContentPage>"                        ;

            XamlLoader.Create(xaml, true);
            var exceptions = new List <Exception>();

#pragma warning disable CS0618 // Type or member is obsolete
            Microsoft.Maui.Controls.Internals.ResourceLoader.ExceptionHandler = exceptions.Add;
#pragma warning restore CS0618 // Type or member is obsolete
            Assert.DoesNotThrow(() => XamlLoader.Create(xaml, true));
            Assert.That(exceptions.Count, Is.GreaterThanOrEqualTo(1));
        }
        public void MissingTypeWithUnknownProperty()
        {
            XamlLoader.FallbackTypeResolver = (p, type) => type ?? typeof(Button);
            XamlLoader.ValueCreatedCallback = (x, v) => {
                if (x.XmlTypeName == "MyCustomButton" && v is VisualElement ve)
                {
                    ve._mergedStyle.ReRegisterImplicitStyles("MissingNamespace.MyCustomButton");
                }
            };

            var xaml = @"
				<ContentPage xmlns=""http://xamarin.com/schemas/2014/forms""
					xmlns:local=""clr-namespace:MissingNamespace;assembly=MissingAssembly""
					xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml"">
					<ContentPage.Content>
						<local:MyCustomButton MyColor=""Red"" />
					</ContentPage.Content>
				</ContentPage>"                ;

            var page = (ContentPage)XamlLoader.Create(xaml, true);

            Assert.That(page.Content, Is.TypeOf <Button>());
        }