forked from xamarin/Xamarin.Forms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
73 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
xmlns:local="using:Xamarin.Forms.Xaml.UnitTests" | ||
x:Class="Xamarin.Forms.Xaml.UnitTests.Gh2171" | ||
x:Name="this" | ||
BindingContext="{local:Gh2171 Foo='foo', Binding={Binding Text, Source={x:Reference this}}, Bar='bar'}"> | ||
</ContentPage> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using System; | ||
using NUnit.Framework; | ||
using Xamarin.Forms.Core.UnitTests; | ||
|
||
namespace Xamarin.Forms.Xaml.UnitTests | ||
{ | ||
public partial class Gh2171 : ContentPage | ||
{ | ||
public Gh2171() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
public Gh2171(bool useCompiledXaml) | ||
{ | ||
//this stub will be replaced at compile time | ||
} | ||
|
||
[TestFixture] | ||
class Tests | ||
{ | ||
[SetUp] | ||
public void Setup() | ||
{ | ||
Device.PlatformServices = new MockPlatformServices(); | ||
} | ||
|
||
[TearDown] | ||
public void TearDown() | ||
{ | ||
Device.PlatformServices = null; | ||
} | ||
|
||
[TestCase(false), TestCase(true)] | ||
public void ParsingNestedMarkups(bool useCompiledXaml) | ||
{ | ||
var layout = new Gh2171(useCompiledXaml); | ||
var markup = layout.BindingContext as Gh2171Extension; | ||
Assert.That(markup, Is.Not.Null); | ||
Assert.That(markup.Foo, Is.EqualTo("foo")); | ||
Assert.That(markup.Bar, Is.EqualTo("bar")); | ||
Assert.That((markup.Binding as Binding).Path, Is.EqualTo("Text")); | ||
} | ||
} | ||
} | ||
|
||
public class Gh2171Extension : IMarkupExtension | ||
{ | ||
public string Foo { get; set; } | ||
public string Bar { get; set; } | ||
public BindingBase Binding { get; set; } | ||
object IMarkupExtension.ProvideValue(IServiceProvider serviceProvider) => this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters