Skip to content
This repository was archived by the owner on Sep 25, 2024. It is now read-only.

Commit f332e8a

Browse files
author
Eric Maupin
committed
[Tests] Allow specifying RealType
1 parent f4273f4 commit f332e8a

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

Xamarin.PropertyEditing.Tests/MockControls/MockControl.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public void AddProperty<T> (string name, string category = null,
1515
bool canWrite = true, bool flag = false,
1616
IEnumerable<Type> converterTypes = null,
1717
string description = null, bool constrained = true, ValueSources valueSources = ValueSources.Local | ValueSources.Default | ValueSources.Binding,
18-
IReadOnlyList<InputMode> inputModes = null, PropertyVariationOption[] options = null, bool isUncommon = false)
18+
IReadOnlyList<InputMode> inputModes = null, PropertyVariationOption[] options = null, bool isUncommon = false, ITypeInfo realType = null)
1919
{
2020
IPropertyInfo propertyInfo;
2121
if (typeof(T).IsEnum) {
@@ -26,7 +26,7 @@ public void AddProperty<T> (string name, string category = null,
2626
} else if (inputModes != null) {
2727
propertyInfo = new MockPropertyInfoWithInputTypes<T> (name, inputModes, description, category, canWrite, converterTypes, valueSources, options);
2828
} else {
29-
propertyInfo = new MockPropertyInfo<T> (name, description, category, canWrite, converterTypes, valueSources, options, isUncommon);
29+
propertyInfo = new MockPropertyInfo<T> (name, description, category, canWrite, converterTypes, valueSources, options, isUncommon, realType);
3030
}
3131

3232
AddProperty<T> (propertyInfo);

Xamarin.PropertyEditing.Tests/MockPropertyInfo/MockPropertyInfo.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public IReadOnlyList<InputMode> InputModes
2323

2424
public class MockPropertyInfo<T> : IPropertyInfo, IPropertyConverter, IEquatable<MockPropertyInfo<T>>
2525
{
26-
public MockPropertyInfo (string name, string description = null, string category = null, bool canWrite = true, IEnumerable<Type> converterTypes = null, ValueSources valueSources = ValueSources.Local | ValueSources.Default, PropertyVariationOption[] options = null, bool isUncommon = false)
26+
public MockPropertyInfo (string name, string description = null, string category = null, bool canWrite = true, IEnumerable<Type> converterTypes = null, ValueSources valueSources = ValueSources.Local | ValueSources.Default, PropertyVariationOption[] options = null, bool isUncommon = false, ITypeInfo realType = null)
2727
{
2828
Name = name;
2929
Description = description;
@@ -43,13 +43,18 @@ public MockPropertyInfo (string name, string description = null, string category
4343
}
4444

4545
Variations = options ?? EmptyVariationOptions;
46+
RealType = realType ?? typeof (T).ToTypeInfo ();
4647
}
4748

4849
public string Name { get; }
4950
public string Description { get; }
5051
public virtual Type Type => typeof (T);
5152

52-
public virtual ITypeInfo RealType => typeof(T).ToTypeInfo ();
53+
public ITypeInfo RealType
54+
{
55+
get;
56+
private set;
57+
}
5358

5459
public string Category { get; }
5560
public bool CanWrite { get; }

0 commit comments

Comments
 (0)