summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Xaml.UnitTests/Issues/Bz53275.xaml.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Xaml.UnitTests/Issues/Bz53275.xaml.cs')
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/Issues/Bz53275.xaml.cs57
1 files changed, 57 insertions, 0 deletions
diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Bz53275.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz53275.xaml.cs
new file mode 100644
index 00000000..ccef92dd
--- /dev/null
+++ b/Xamarin.Forms.Xaml.UnitTests/Issues/Bz53275.xaml.cs
@@ -0,0 +1,57 @@
+using System;
+using System.Reflection;
+using NUnit.Framework;
+using Xamarin.Forms.Core.UnitTests;
+
+namespace Xamarin.Forms.Xaml.UnitTests
+{
+ public class TargetPropertyExtension : IMarkupExtension
+ {
+ public object ProvideValue(IServiceProvider serviceProvider)
+ {
+ var targetProperty = (serviceProvider?.GetService(typeof(IProvideValueTarget)) as IProvideValueTarget)?.TargetProperty;
+ return (targetProperty as BindableProperty)?.PropertyName ?? (targetProperty as PropertyInfo)?.Name;
+ }
+ }
+
+ public partial class Bz53275 : ContentPage
+ {
+ public Bz53275()
+ {
+ InitializeComponent();
+ }
+
+ public Bz53275(bool useCompiledXaml)
+ {
+ //this stub will be replaced at compile time
+ }
+
+ public string ANonBindableProperty { get; set; }
+
+ [TestFixture]
+ class Tests
+ {
+ [SetUp]
+ public void Setup()
+ {
+ Device.PlatformServices = new MockPlatformServices();
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ Device.PlatformServices = null;
+ }
+
+ [TestCase(true)]
+ [TestCase(false)]
+ public void TargetPropertyIsSetOnMarkups(bool useCompiledXaml)
+ {
+ var page = new Bz53275(useCompiledXaml);
+ Assert.AreEqual("ANonBindableProperty", page.ANonBindableProperty);
+ var l0 = page.label;
+ Assert.AreEqual("Text", l0.Text);
+ }
+ }
+ }
+} \ No newline at end of file