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)); }
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)); }
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)); }
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); }