예제 #1
0
        public void TestConnectingEventOnMethodWithWrongSignature()
        {
            var xaml = @"
				<View 
				xmlns=""http://xamarin.com/schemas/2014/forms""
				xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml""
				x:Class=""Xamarin.Forms.Xaml.UnitTests.CustView"" Activated=""wrongSignature"" />
				</View>"                ;
            var view = new CustView();

            Assert.Throws(new XamlParseExceptionConstraint(5, 53), () => view.LoadFromXaml(xaml));
        }
예제 #2
0
파일: LoaderTests.cs 프로젝트: hevey/maui
        public void TestConnectingEventOnMethodWithWrongSignature()
        {
            var xaml = @"
				<View 
				xmlns=""http://schemas.microsoft.com/dotnet/2021/maui""
				xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml""
				x:Class=""Microsoft.Maui.Controls.Xaml.UnitTests.CustView"" Clicked=""wrongSignature"" />
				</View>"                ;
            var view = new CustView();

            Assert.Throws(new XamlParseExceptionConstraint(5, 63), () => view.LoadFromXaml(xaml));
        }
예제 #3
0
        public void TestFailingEvent()
        {
            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.CustView"" Activated=""missingMethod"" />
				</View>"                ;
            var view = new CustView();

            Assert.Throws(new XamlParseExceptionConstraint(5, 53), () => view.LoadFromXaml(xaml));
        }
예제 #4
0
        public void TestEvent()
        {
            var xaml = @"
				<Button 
				xmlns=""http://xamarin.com/schemas/2014/forms""
				xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml""
				x:Class=""Xamarin.Forms.Xaml.UnitTests.CustView"" Clicked=""onButtonClicked"" />
				</Button>"                ;
            var view = new CustView();

            view.LoadFromXaml(xaml);
            Assert.False(view.fired);
            ((IButtonController)view).SendClicked();
            Assert.True(view.fired);
        }