2016-12-05 00:08:11 +03:00
|
|
|
|
using System;
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using Xamarin.Forms.Core.UnitTests;
|
|
|
|
|
|
|
|
|
|
namespace Xamarin.Forms.Xaml.UnitTests
|
|
|
|
|
{
|
|
|
|
|
[XamlCompilation(XamlCompilationOptions.Skip)]
|
|
|
|
|
public partial class FactoryMethodMissingMethod : MockView
|
|
|
|
|
{
|
|
|
|
|
public FactoryMethodMissingMethod()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-02 12:57:50 +03:00
|
|
|
|
public FactoryMethodMissingMethod(bool useCompiledXaml)
|
|
|
|
|
{
|
|
|
|
|
//this stub will be replaced at compile time
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-05 00:08:11 +03:00
|
|
|
|
[TestFixture]
|
|
|
|
|
public class Tests
|
|
|
|
|
{
|
|
|
|
|
[SetUp]
|
|
|
|
|
public void SetUp()
|
|
|
|
|
{
|
|
|
|
|
Device.PlatformServices = new MockPlatformServices();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestCase(false)]
|
|
|
|
|
[TestCase(true)]
|
|
|
|
|
public void Throw(bool useCompiledXaml)
|
|
|
|
|
{
|
|
|
|
|
if (useCompiledXaml)
|
|
|
|
|
Assert.Throws(new XamlParseExceptionConstraint(8, 4), () => MockCompiler.Compile(typeof(FactoryMethodMissingMethod)));
|
|
|
|
|
else
|
2017-02-02 12:57:50 +03:00
|
|
|
|
Assert.Throws<MissingMemberException>(() => new FactoryMethodMissingMethod(useCompiledXaml));
|
2016-12-05 00:08:11 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|