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>2018-09-17 20:59:39 +0300
committerEric Maupin <ermaup@microsoft.com>2018-09-17 20:59:39 +0300
commit6988236fac0452757dca56b4e472d96d32e64f8d (patch)
tree350e6f088e7519298b615daefe240d10e7ff4a6c /Xamarin.PropertyEditing.Tests
parente6029e8ee6f9722fe20522bdd1b746b25949bb67 (diff)
[Tests] Add unconstrained enum to test properties
Diffstat (limited to 'Xamarin.PropertyEditing.Tests')
-rw-r--r--Xamarin.PropertyEditing.Tests/MockControls/MockControl.cs4
-rw-r--r--Xamarin.PropertyEditing.Tests/MockControls/MockSampleControl.cs2
-rw-r--r--Xamarin.PropertyEditing.Tests/MockPropertyInfo/MockEnumPropertyInfo.cs5
3 files changed, 6 insertions, 5 deletions
diff --git a/Xamarin.PropertyEditing.Tests/MockControls/MockControl.cs b/Xamarin.PropertyEditing.Tests/MockControls/MockControl.cs
index b7685ba..8004461 100644
--- a/Xamarin.PropertyEditing.Tests/MockControls/MockControl.cs
+++ b/Xamarin.PropertyEditing.Tests/MockControls/MockControl.cs
@@ -14,14 +14,14 @@ namespace Xamarin.PropertyEditing.Tests.MockControls
public void AddProperty<T> (string name, string category = null,
bool canWrite = true, bool flag = false,
IEnumerable<Type> converterTypes = null,
- string description = null, ValueSources valueSources = ValueSources.Local | ValueSources.Default | ValueSources.Binding)
+ string description = null, bool constrained = true, ValueSources valueSources = ValueSources.Local | ValueSources.Default | ValueSources.Binding)
{
IPropertyInfo propertyInfo;
if (typeof(T).IsEnum) {
var underlyingType = typeof (T).GetEnumUnderlyingType ();
var enumPropertyInfoType = typeof (MockEnumPropertyInfo<,>)
.MakeGenericType (underlyingType, typeof (T));
- propertyInfo = (IPropertyInfo)Activator.CreateInstance (enumPropertyInfoType, name, description, category, canWrite, flag, converterTypes);
+ propertyInfo = (IPropertyInfo)Activator.CreateInstance (enumPropertyInfoType, name, description, category, canWrite, flag, converterTypes, constrained);
} else {
propertyInfo = new MockPropertyInfo<T> (name, description, category, canWrite, converterTypes, valueSources);
}
diff --git a/Xamarin.PropertyEditing.Tests/MockControls/MockSampleControl.cs b/Xamarin.PropertyEditing.Tests/MockControls/MockSampleControl.cs
index faafc83..3fe6e51 100644
--- a/Xamarin.PropertyEditing.Tests/MockControls/MockSampleControl.cs
+++ b/Xamarin.PropertyEditing.Tests/MockControls/MockSampleControl.cs
@@ -16,7 +16,7 @@ namespace Xamarin.PropertyEditing.Tests.MockControls
AddProperty<int> ("UnsetInteger", ReadWrite, valueSources: ValueSources.Local);
AddProperty<float> ("FloatingPoint", ReadWrite);
AddProperty<string> ("String", ReadWrite, valueSources: ValueSources.Local | ValueSources.Resource | ValueSources.Binding);
- AddProperty<Enumeration> ("Enumeration", ReadWrite);
+ AddProperty<Enumeration> ("Enumeration", ReadWrite, constrained: false);
AddProperty<FlagsNoValues> ("FlagsNoValues", ReadWrite, canWrite: true, flag: true);
AddProperty<FlagsWithValues> ("FlagsWithValues", ReadWrite, canWrite: true, flag: true);
AddProperty<CommonPoint> ("Point", ReadWrite);
diff --git a/Xamarin.PropertyEditing.Tests/MockPropertyInfo/MockEnumPropertyInfo.cs b/Xamarin.PropertyEditing.Tests/MockPropertyInfo/MockEnumPropertyInfo.cs
index 42342f9..fd4be86 100644
--- a/Xamarin.PropertyEditing.Tests/MockPropertyInfo/MockEnumPropertyInfo.cs
+++ b/Xamarin.PropertyEditing.Tests/MockPropertyInfo/MockEnumPropertyInfo.cs
@@ -15,7 +15,7 @@ namespace Xamarin.PropertyEditing.Tests.MockPropertyInfo
where TUnderlying : struct
where TEnum : struct
{
- public MockEnumPropertyInfo (string name, string description = null, string category = "", bool canWrite = true, bool flag = false, IEnumerable<Type> converterTypes = null)
+ public MockEnumPropertyInfo (string name, string description = null, string category = "", bool canWrite = true, bool flag = false, IEnumerable<Type> converterTypes = null, bool constrained = true)
: base (name, description, category, canWrite, converterTypes)
{
var names = Enum.GetNames (typeof (TEnum));
@@ -33,12 +33,13 @@ namespace Xamarin.PropertyEditing.Tests.MockPropertyInfo
PredefinedValues = predefinedValues;
}
+ IsConstrainedToPredefined = constrained;
IsValueCombinable = flag;
}
public override Type Type => typeof (TEnum);
- public bool IsConstrainedToPredefined => true;
+ public bool IsConstrainedToPredefined { get; }
public bool IsValueCombinable { get; }