Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/xamarin/Xamarin.PropertyEditing.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Maupin <ermaup@microsoft.com>2017-01-25 20:24:42 +0300
committerEric Maupin <ermaup@microsoft.com>2017-01-25 20:24:42 +0300
commit5def2f1ab832a192f866fe83004ca42062e56e07 (patch)
tree049f4dfe611d1a4cf86c25cd114b55f5127068e1 /Xamarin.PropertyEditing.Tests/ReflectionPropertyProviderTests.cs
parent66d83c7c6fea8b231ba4f52dd0a540603bf7354f (diff)
Add reflection unbrowsable test
Diffstat (limited to 'Xamarin.PropertyEditing.Tests/ReflectionPropertyProviderTests.cs')
-rw-r--r--Xamarin.PropertyEditing.Tests/ReflectionPropertyProviderTests.cs35
1 files changed, 35 insertions, 0 deletions
diff --git a/Xamarin.PropertyEditing.Tests/ReflectionPropertyProviderTests.cs b/Xamarin.PropertyEditing.Tests/ReflectionPropertyProviderTests.cs
index 8c8ced0..189f87a 100644
--- a/Xamarin.PropertyEditing.Tests/ReflectionPropertyProviderTests.cs
+++ b/Xamarin.PropertyEditing.Tests/ReflectionPropertyProviderTests.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
+using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Text;
@@ -189,6 +190,40 @@ namespace Xamarin.PropertyEditing.Tests
Assert.That (obj.Property.Property, Is.EqualTo (value));
}
+ /// <remarks>
+ /// Mac objects can sometimes define properties on types (say, like NSView) that aren't accessible on
+ /// some implementations. Normally you'd ask it if it can respond to the selector, but in generic code
+ /// your only recourse is to look for the DebuggerBrowsableAttribute.
+ /// </remarks>
+ [Test]
+ [NUnit.Framework.Description ("Properties marked DebuggerBrowsable (Never) should not be included in the list of properties.")]
+ public async Task DontSetupPropertiesMarkedUnbrowsable ()
+ {
+ var unbrowsable = new Unbrowsable();
+
+ var provider = new ReflectionEditorProvider();
+ IObjectEditor editor = await provider.GetObjectEditorAsync (unbrowsable);
+
+ Assert.That (editor.Properties.Count, Is.EqualTo (1), "Wrong number of properties");
+ Assert.That (editor.Properties.Single ().Name, Is.EqualTo (nameof (Unbrowsable.VisibleProperty)));
+ }
+
+ private class Unbrowsable
+ {
+ public string VisibleProperty
+ {
+ get;
+ set;
+ }
+
+ [DebuggerBrowsable (DebuggerBrowsableState.Never)]
+ public string InvisibleProperty
+ {
+ get;
+ set;
+ }
+ }
+
private class Converter2
: TypeConverter
{