This repository has been archived by the owner on May 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[X] throw on mismatching param type for Add() (#11086)
There was a `TODO: check parameter type` in this code, like if past me knew that, at some point in time, what was only a potential edge case bug, would explode in my face and ruin my faith in humanity. Those FIXMEs... they are bottled 'I TOLD YOU SO' little time capsules - fixes #11061
- Loading branch information
1 parent
92ed051
commit 5754d1a
Showing
3 changed files
with
75 additions
and
15 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
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,7 @@ | ||
<?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.Gh11061" | ||
MyDateTime="{Binding Date}"> | ||
</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,38 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using NUnit.Framework; | ||
using Xamarin.Forms; | ||
using Xamarin.Forms.Build.Tasks; | ||
using Xamarin.Forms.Core.UnitTests; | ||
|
||
namespace Xamarin.Forms.Xaml.UnitTests | ||
{ | ||
[XamlCompilation(XamlCompilationOptions.Skip)] | ||
public partial class Gh11061 : ContentPage | ||
{ | ||
public DateTime MyDateTime { get; set; } | ||
|
||
public Gh11061() => InitializeComponent(); | ||
public Gh11061(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; | ||
|
||
[Test] | ||
public void XamlCBindingOnNonBP([Values(false, true)] bool useCompiledXaml) | ||
{ | ||
if (useCompiledXaml) | ||
Assert.Throws<BuildException>(() => MockCompiler.Compile(typeof(Gh11061))); | ||
else | ||
Assert.Throws<XamlParseException>(()=> new Gh11061(useCompiledXaml) { BindingContext = new { Date = DateTime.Today} }); | ||
} | ||
} | ||
} | ||
} | ||
|