summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Xaml.UnitTests
diff options
context:
space:
mode:
authorStephane Delcroix <stephane@delcroix.org>2016-12-30 17:58:48 +0100
committerE.Z. Hart <hartez@users.noreply.github.com>2016-12-30 09:58:48 -0700
commit32dab1d3c7641688e9435be22297e092bcdb5ee6 (patch)
tree46679ada9e2610ea05aa68810a6a85a375e1955b /Xamarin.Forms.Xaml.UnitTests
parentefc1e93f8156df8e84605b118a2f455b8dcf36ab (diff)
downloadxamarin-forms-32dab1d3c7641688e9435be22297e092bcdb5ee6.tar.gz
xamarin-forms-32dab1d3c7641688e9435be22297e092bcdb5ee6.tar.bz2
xamarin-forms-32dab1d3c7641688e9435be22297e092bcdb5ee6.zip
[XamlC] detect duplicate x:Name at compile time (#655)
* [XamlC] detect duplicate x:Name at compile time * invoking methods with the right arguments produces better results
Diffstat (limited to 'Xamarin.Forms.Xaml.UnitTests')
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/Issues/Issue2125.xaml7
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/Issues/Issue2125.xaml.cs33
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/Issues/Issue2450.xaml.cs9
-rw-r--r--Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj6
4 files changed, 8 insertions, 47 deletions
diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Issue2125.xaml b/Xamarin.Forms.Xaml.UnitTests/Issues/Issue2125.xaml
deleted file mode 100644
index c2bc239c..00000000
--- a/Xamarin.Forms.Xaml.UnitTests/Issues/Issue2125.xaml
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Xamarin.Forms.Xaml.UnitTests.Issue2125">
- <StackLayout>
- <Label x:Name="label"/>
- <Label x:Name="label"/>
- </StackLayout>
-</ContentPage> \ No newline at end of file
diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Issue2125.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/Issues/Issue2125.xaml.cs
deleted file mode 100644
index 8c4dcf80..00000000
--- a/Xamarin.Forms.Xaml.UnitTests/Issues/Issue2125.xaml.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-using Xamarin.Forms;
-
-using NUnit.Framework;
-
-namespace Xamarin.Forms.Xaml.UnitTests
-{
- public partial class Issue2125 : ContentPage
- {
- public Issue2125 ()
- {
- InitializeComponent ();
- }
-
- public Issue2125 (bool useCompiledXaml)
- {
- //this stub will be replaced at compile time
- }
-
- [TestFixture]
- public class Tests
- {
- [TestCase (false)]
- [TestCase (true)]
- public void DuplicatexName (bool useCompiledXaml)
- {
- Assert.Throws (new XamlParseExceptionConstraint (5, 10), () => new Issue2125 (useCompiledXaml));
- }
- }
- }
-} \ No newline at end of file
diff --git a/Xamarin.Forms.Xaml.UnitTests/Issues/Issue2450.xaml.cs b/Xamarin.Forms.Xaml.UnitTests/Issues/Issue2450.xaml.cs
index 0cf6f56c..2d330934 100644
--- a/Xamarin.Forms.Xaml.UnitTests/Issues/Issue2450.xaml.cs
+++ b/Xamarin.Forms.Xaml.UnitTests/Issues/Issue2450.xaml.cs
@@ -5,6 +5,8 @@ using Xamarin.Forms.Core.UnitTests;
namespace Xamarin.Forms.Xaml.UnitTests
{
+ //this covers Issue2125 as well
+ [XamlCompilation(XamlCompilationOptions.Skip)]
public partial class Issue2450 : ContentPage
{
public Issue2450 ()
@@ -30,7 +32,12 @@ namespace Xamarin.Forms.Xaml.UnitTests
[TestCase (true)]
public void ThrowMeaningfulExceptionOnDuplicateXName (bool useCompiledXaml)
{
- Assert.Throws (new XamlParseExceptionConstraint (8, 10, m => m == "An element with the name \"label0\" already exists in this NameScope"), () => new Issue2450 (useCompiledXaml));
+ if (useCompiledXaml)
+ Assert.Throws(new XamlParseExceptionConstraint(8, 10, m => m == "An element with the name \"label0\" already exists in this NameScope"),
+ () => MockCompiler.Compile(typeof(Issue2450)));
+ else
+ Assert.Throws(new XamlParseExceptionConstraint(8, 10, m => m == "An element with the name \"label0\" already exists in this NameScope"),
+ () => new Issue2450(useCompiledXaml));
}
}
}
diff --git a/Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj b/Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj
index 8864a388..b66a0824 100644
--- a/Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj
+++ b/Xamarin.Forms.Xaml.UnitTests/Xamarin.Forms.Xaml.UnitTests.csproj
@@ -131,9 +131,6 @@
<Compile Include="Issues\Issue2114.xaml.cs">
<DependentUpon>Issue2114.xaml</DependentUpon>
</Compile>
- <Compile Include="Issues\Issue2125.xaml.cs">
- <DependentUpon>Issue2125.xaml</DependentUpon>
- </Compile>
<Compile Include="Validation\StaticExtensionException.xaml.cs">
<DependentUpon>StaticExtensionException.xaml</DependentUpon>
</Compile>
@@ -469,9 +466,6 @@
<EmbeddedResource Include="Issues\Issue2114.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
- <EmbeddedResource Include="Issues\Issue2125.xaml">
- <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
- </EmbeddedResource>
<EmbeddedResource Include="Validation\StaticExtensionException.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>