Esempio n. 1
0
        public void ParseEnum()
        {
            var xaml = @"
				<local:CustomView
				xmlns=""http://xamarin.com/schemas/2014/forms""
				xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml""
				xmlns:local=""clr-namespace:System.Maui.Xaml.UnitTests;assembly=System.Maui.Xaml.UnitTests"" 
				MockFlags=""Bar""
				/>"                ;
            var view = new CustomView().LoadFromXaml(xaml);

            Assert.AreEqual(MockFlags.Bar, view.MockFlags);
        }
Esempio n. 2
0
        public void TestSetBindingToNonBindablePropertyShouldThrow()
        {
            var xaml = @"
				<View 
				xmlns=""http://xamarin.com/schemas/2014/forms""
				xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml""
				x:Class=""System.Maui.Xaml.UnitTests.CustomView"" 
				Name=""customView"" 
				NotBindable=""{Binding text}""
				/>"                ;

            var view = new CustomView();

            Assert.Throws(new XamlParseExceptionConstraint(6, 5), () => view.LoadFromXaml(xaml));
        }
Esempio n. 3
0
        public void TestContentProperties()
        {
            var        xaml       = @"
				<local:CustomView
				xmlns=""http://xamarin.com/schemas/2014/forms""
				xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml""
				xmlns:local=""clr-namespace:System.Maui.Xaml.UnitTests;assembly=System.Maui.Xaml.UnitTests"" >
					<Label x:Name=""contentview""/>
				</local:CustomView>"                ;
            CustomView customView = null;

            Assert.DoesNotThrow(() => customView = new CustomView().LoadFromXaml(xaml));
            Assert.NotNull(customView.Content);
            Assert.AreSame(customView.Content, ((System.Maui.Internals.INameScope)customView).FindByName("contentview"));
        }
Esempio n. 4
0
        public void TestRootName()
        {
            var xaml = @"
				<View
				xmlns=""http://xamarin.com/schemas/2014/forms""
				xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml""
				x:Class=""System.Maui.Xaml.UnitTests.CustomView"" 
				x:Name=""customView"" 
				/>"                ;

            var view = new CustomView();

            view.LoadFromXaml(xaml);

            Assert.AreSame(view, ((System.Maui.Internals.INameScope)view).FindByName("customView"));
        }
Esempio n. 5
0
        public void ThrowOnMissingXamlResource()
        {
            var view = new CustomView();

            Assert.Throws(new XamlParseExceptionConstraint(), () => view.LoadFromXaml(typeof(CustomView)));
        }