Ejemplo n.º 1
0
        public Task <IReadOnlyList <object> > GetRootElementsAsync(BindingSource source, object target)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            if (source.Type != BindingSourceType.Object && source.Type != BindingSourceType.SingleObject)
            {
                throw new ArgumentException("source.Type was not Object", nameof(source));
            }

            if (source is BindingSourceInstance instance)
            {
                source = instance.Original;
            }

            if (source == RelativeSelf)
            {
                return(Task.FromResult <IReadOnlyList <object> > (new [] { target }));
            }
            if (source == StaticResource)
            {
                return(MockResourceProvider.GetResourceSourcesAsync(target).ContinueWith(t => (IReadOnlyList <object>)t.Result));
            }

            throw new NotImplementedException();
        }
 Task <IReadOnlyList <ResourceSource> > IResourceProvider.GetResourceSourcesAsync(object target)
 {
     return(MockResourceProvider.GetResourceSourcesAsync(target));
 }