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-07-13 18:54:33 +0300
committerEric Maupin <ermaup@microsoft.com>2018-07-19 00:06:18 +0300
commit0ef83d908f97616e724986cf41917dc02bb8d5af (patch)
treec0fb70f925c7b1314b17e244a3d64f3c647600a8 /Xamarin.PropertyEditing.Tests/PropertyViewModelTests.cs
parent8a2e35636b82e40b19cc3291e422fde2dd7bc894 (diff)
[Core] Split SourceDescriptor out from ValueDescriptor
ValueDescriptor ended up being used for overlapping purposes: binding/resources for the source but then for some values like objects and predfined values it had extra information not contained in the Value. SourceDescriptor was added to hold things like bindings or resources that describe where the value came from, while ValueDescriptor will continue to hold extra details about the value. There were two possible approaches to this, to add the object property as-is in this commit, or to add bespoke properties for a Resource and Binding. Ultimately both approaches have fairly similar level pros and cons. What it ended up coming down to for me is that these properties are mutually exclusive. While we can guard against this in a few ways (target the same backing property, throw an exception), both of these cases require extra code to be mindful of in some usage where it does not with a single property, or worse it is silently unexpected behavior. While it is cleaner to not have to cast, the risk of introducing extra code complexity for the sake of structure tips the scales.
Diffstat (limited to 'Xamarin.PropertyEditing.Tests/PropertyViewModelTests.cs')
-rw-r--r--Xamarin.PropertyEditing.Tests/PropertyViewModelTests.cs8
1 files changed, 4 insertions, 4 deletions
diff --git a/Xamarin.PropertyEditing.Tests/PropertyViewModelTests.cs b/Xamarin.PropertyEditing.Tests/PropertyViewModelTests.cs
index 04a23af..a24b2ee 100644
--- a/Xamarin.PropertyEditing.Tests/PropertyViewModelTests.cs
+++ b/Xamarin.PropertyEditing.Tests/PropertyViewModelTests.cs
@@ -434,8 +434,8 @@ namespace Xamarin.PropertyEditing.Tests
var resourcesMock = new Mock<IResourceProvider> ();
resourcesMock.Setup (rp => rp.GetResourcesAsync (editor.Target, mockProperty.Object, It.IsAny<CancellationToken> ())).ReturnsAsync (new[] { resource });
- editor.ValueEvaluator = (info, o) => {
- if (o == resource)
+ editor.ValueEvaluator = (info, val, source) => {
+ if (source == resource)
return value;
return default(TValue);
@@ -464,7 +464,7 @@ namespace Xamarin.PropertyEditing.Tests
var editor = new MockObjectEditor (mockProperty.Object);
await editor.SetValueAsync (mockProperty.Object, new ValueInfo<TValue> {
Source = ValueSource.Resource,
- ValueDescriptor = resource,
+ SourceDescriptor = resource,
Value = value
});
@@ -490,7 +490,7 @@ namespace Xamarin.PropertyEditing.Tests
var editor = new MockObjectEditor (mockProperty.Object);
await editor.SetValueAsync (mockProperty.Object, new ValueInfo<TValue> {
Source = ValueSource.Resource,
- ValueDescriptor = resource,
+ SourceDescriptor = resource,
Value = value
});