-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathXmlnsCollision.xaml.cs
More file actions
66 lines (59 loc) · 1.77 KB
/
Copy pathXmlnsCollision.xaml.cs
File metadata and controls
66 lines (59 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
using Microsoft.Maui.ApplicationModel;
using Microsoft.Maui.Controls;
using Microsoft.Maui.Controls.Build.Tasks;
using Microsoft.Maui.Controls.Core.UnitTests;
using NUnit.Framework;
[assembly: XmlnsDefinition("http://companyone.com/schemas/toolkit", "CompanyOne.Controls")]
[assembly: XmlnsPrefix("http://companyone.com/schemas/toolkit", "c1")]
[assembly: XmlnsDefinition("http://companytwo.com/schemas/toolkit", "CompanyTwo.Controls")]
[assembly: XmlnsPrefix("http://companytwo.com/schemas/toolkit", "c2")]
[assembly: XmlnsDefinition("http://schemas.microsoft.com/dotnet/maui/global", "http://companyone.com/schemas/toolkit")]
[assembly: XmlnsDefinition("http://schemas.microsoft.com/dotnet/maui/global", "http://companytwo.com/schemas/toolkit")]
namespace CompanyOne.Controls
{
public class ConflictingLabel : Label
{
}
}
namespace CompanyTwo.Controls
{
public class ConflictingLabel : Label
{
}
}
namespace Microsoft.Maui.Controls.Xaml.UnitTests
{
[XamlCompilation(XamlCompilationOptions.Skip)]
public partial class XmlnsCollision : ContentPage
{
public XmlnsCollision()
{
InitializeComponent();
}
public XmlnsCollision(bool useCompiledXaml)
{
//this stub will be replaced at compile time
}
[TestFixture]
class Test
{
[SetUp] public void Setup() => AppInfo.SetCurrent(new MockAppInfo());
[TearDown] public void TearDown() => AppInfo.SetCurrent(null);
[Test]
public void ConflictInXmlns([Values] bool useCompiledXaml)
{
if (useCompiledXaml)
Assert.Throws<BuildException>(() =>
{
MockCompiler.Compile(typeof(XmlnsCollision), out var hasLoggedErrors);
Assert.IsTrue(hasLoggedErrors);
});
else
Assert.Throws<XamlParseException>(() =>
{
var layout = new XmlnsCollision(useCompiledXaml);
});
}
}
}
}