public void NeedsToBeBoxed_EventWithReferenceTypeToObject_ReturnFalse() { Type actualType = typeof(ObservableEvent <string>); Type targetType = typeof(IObservableEvent <object>); bool needsToBeBoxed = BindingUtils.NeedsToBeBoxed(actualType, targetType); needsToBeBoxed.Should().BeFalse(); }
public void NeedsToBeBoxed_CollectionWithReferenceTypeToObject_ReturnFalse() { Type actualType = typeof(ObservableCollection <string>); Type targetType = typeof(IReadOnlyObservableCollection <object>); bool needsToBeBoxed = BindingUtils.NeedsToBeBoxed(actualType, targetType); needsToBeBoxed.Should().BeFalse(); }
public void NeedsToBeBoxed_EventWithBuiltInValueTypeToObject_ReturnTrue() { Type actualType = typeof(ObservableEvent <int>); Type targetType = typeof(IObservableEvent <object>); bool needsToBeBoxed = BindingUtils.NeedsToBeBoxed(actualType, targetType); needsToBeBoxed.Should().BeTrue(); }
public void NeedsToBeBoxed_CollectionWithBuiltInValueTypeToObject_ReturnTrue() { Type actualType = typeof(ObservableCollection <int>); Type targetType = typeof(IReadOnlyObservableCollection <object>); bool needsToBeBoxed = BindingUtils.NeedsToBeBoxed(actualType, targetType); needsToBeBoxed.Should().BeTrue(); }
protected override void BindProperty(object property) { boundProperty = property as IReadOnlyObservableVariable <T>; if (boundProperty == null && BindingUtils.NeedsToBeBoxed(property.GetType(), typeof(IReadOnlyObservableVariable <T>))) { boundProperty = BoxVariable(property); } if (boundProperty != null) { boundProperty.Changed += OnBoundPropertyChanged; RaiseFirstNotification(); } else { Debug.LogError($"Property type ({property.GetType()}) cannot be bound as {typeof(IReadOnlyObservableVariable<T>)}", context); } }