//this requirement might change, see https://github.com/xamarin/Microsoft.Maui.Controls/issues/12425 public void xKeyRequireStringLiteral([Values(false, true)] bool useCompiledXaml) { if (useCompiledXaml) { Assert.Throws <BuildException>(() => MockCompiler.Compile(typeof(xKeyLiteral))); } else { Assert.Throws <XamlParseException>(() => new xKeyLiteral(useCompiledXaml)); } }
public void ThrowOnInstanceProperty(bool useCompiledXaml) { if (useCompiledXaml) { Assert.Throws(new BuildExceptionConstraint(7, 6), () => MockCompiler.Compile(typeof(XStaticException))); } else { Assert.Throws(new XamlParseExceptionConstraint(7, 6), () => new XStaticException(useCompiledXaml)); } }
public void ReportSyntaxError([Values(false /*, true*/)] bool useCompiledXaml) { if (useCompiledXaml) { Assert.Throws <BuildException>(() => MockCompiler.Compile(typeof(Gh5378_1))); } else { Assert.Throws <XamlParseException>(() => new Gh5378_1(useCompiledXaml)); } }
public void ShouldThrow(bool useCompiledXaml) { if (useCompiledXaml) { Assert.Throws(new BuildExceptionConstraint(10, 13), () => MockCompiler.Compile(typeof(SetterOnNonBP))); } else { Assert.Throws(new XamlParseExceptionConstraint(10, 13), () => new SetterOnNonBP(useCompiledXaml)); } }
public void GenericBPCompiles([Values(false, true)] bool useCompiledXaml) { if (useCompiledXaml) { MockCompiler.Compile(typeof(Gh7559)); } var layout = new Gh7559(useCompiledXaml); var value = Gh7559Generic <Gh7559Enum> .GetIcon(layout); Assert.That(value, Is.EqualTo(Gh7559Enum.LetterA)); }
public void InvalidMarkupAssignmentThrowsXPE([Values(false, true)] bool useCompiledXaml) { if (useCompiledXaml) { Assert.Throws <BuildException>(() => MockCompiler.Compile(typeof(Gh7187))); } else { Assert.Throws <XamlParseException>(() => new Gh7187(useCompiledXaml)); } }
public void Throw([Values(false, true)] bool useCompiledXaml) { if (useCompiledXaml) { Assert.Throws(new BuildExceptionConstraint(7, 4), () => MockCompiler.Compile(typeof(FactoryMethodMissingCtor))); } else { Assert.Throws <MissingMethodException>(() => new FactoryMethodMissingCtor(useCompiledXaml)); } }
public void InvalidSourceThrows(bool useCompiledXaml) { if (useCompiledXaml) { Assert.Throws(new BuildExceptionConstraint(8, 33), () => MockCompiler.Compile(typeof(ResourceDictionaryWithInvalidSource))); } else { Assert.Throws(new XamlParseExceptionConstraint(8, 33), () => new ResourceDictionaryWithInvalidSource(useCompiledXaml)); } }
public void FormatExceptionAreCaught([Values(false, true)] bool useCompiledXaml) { if (useCompiledXaml) { Assert.Throws <BuildException>(() => MockCompiler.Compile(typeof(Gh11711))); } else { Assert.Throws <XamlParseException>(() => new Gh11711(useCompiledXaml)); } }
public void DetailedErrorMessageOnMissingXmlnsDeclaration(bool useCompiledXaml) { if (useCompiledXaml) { Assert.Throws <BuildException>(() => MockCompiler.Compile(typeof(Gh2063))); } else { Assert.Throws <XamlParseException>(() => new Gh2063(useCompiledXaml)); } }
public void Throw(bool useCompiledXaml) { if (useCompiledXaml) { Assert.Throws(new BuildExceptionConstraint(8, 4), () => MockCompiler.Compile(typeof(FactoryMethodMissingMethod))); } else { Assert.Throws <MissingMemberException>(() => new FactoryMethodMissingMethod(useCompiledXaml)); } }
public void ThrowsOnDuplicateXKey(bool useCompiledXaml) { if (useCompiledXaml) { Assert.Throws <BuildException>(() => MockCompiler.Compile(typeof(Gh3512))); } else { Assert.Throws <ArgumentException>(() => new Gh3512(useCompiledXaml)); } }
public void ThrowsOnInvalidXaml([Values(false, true)] bool useCompiledXaml) { if (useCompiledXaml) { Assert.Throws <BuildException>(() => MockCompiler.Compile(typeof(Gh5095))); } else { Assert.Throws <XamlParseException>(() => new Gh5095(false)); } }
public void BindingContextWithConverter(bool useCompiledXaml) { if (useCompiledXaml) { Assert.Throws <BuildException>(() => MockCompiler.Compile(typeof(Bz55862))); } else { Assert.Throws <XamlParseException>(() => new Bz55862(useCompiledXaml)); } }
public void ReportMissingTargetTypeOnStyle(bool useCompiledXaml) { if (useCompiledXaml) { Assert.Throws <BuildException>(() => MockCompiler.Compile(typeof(Gh2064))); } else { Assert.Throws <XamlParseException>(() => new Gh2064(useCompiledXaml)); } }
public void ThrowsOnWrongEventHandlerSignature(bool useCompiledXaml) { if (useCompiledXaml) { Assert.Throws <BuildException>(() => MockCompiler.Compile(typeof(Gh3082))); } else { Assert.Throws <XamlParseException>(() => new Gh3082(false)); } }
public void BindingWithMultipleIndexers([Values(false, true)] bool useCompiledXaml) { if (useCompiledXaml) { MockCompiler.Compile(typeof(Gh7837)); } var layout = new Gh7837(useCompiledXaml); Assert.That(layout.label0.Text, Is.EqualTo("forty-two")); Assert.That(layout.label1.Text, Is.EqualTo("FOO")); Assert.That(layout.label2.Text, Is.EqualTo("forty-two")); Assert.That(layout.label3.Text, Is.EqualTo("FOO")); }
public void BindingAsElement(bool useCompiledXaml) { if (useCompiledXaml) { Assert.DoesNotThrow(() => MockCompiler.Compile(typeof(Gh4572))); } var layout = new Gh4572(useCompiledXaml) { BindingContext = new { labeltext = "Foo" } }; Assert.That(layout.label.Text, Is.EqualTo("Foo")); }
public void FindMemberOnInterfaces(bool useCompiledXaml) { if (useCompiledXaml) { Assert.DoesNotThrow(() => MockCompiler.Compile(typeof(Gh4227))); } var layout = new Gh4227(useCompiledXaml) { BindingContext = new Gh4227VM() }; Assert.That(layout.label0.Text, Is.EqualTo("level0")); Assert.That(layout.label1.Text, Is.EqualTo("level1")); }
public void RDInDataTemplates(bool useCompiledXaml) { if (useCompiledXaml) { MockCompiler.Compile(typeof(Bz42531)); } var p = new Bz42531(useCompiledXaml); ListView lv = p.lv; var template = lv.ItemTemplate; var cell = template.CreateContent(null, lv) as ViewCell; var sl = cell.View as StackLayout; Assert.AreEqual(1, sl.Resources.Count); var label = sl.Children[0] as Label; Assert.AreEqual(LayoutOptions.Center, label.HorizontalOptions); }
public void DefinitionCollectionsReplacedAtCompilation() { MockCompiler.Compile(typeof(DefinitionCollectionTests), out var methodDef); Assert.That(!methodDef.Body.Instructions.Any(instr => InstructionIsDefColConvCtor(methodDef, instr)), "This Xaml still generates [Row|Col]DefinitionCollectionTypeConverter ctor"); }