using System; using System.Collections.Generic; using System.Linq; using Umbraco.Core.Scoping; using Umbraco.Web.PublishedCache.NuCache; using Umbraco.Web.PublishedCache.NuCache.DataSource; namespace Umbraco.Tests.Testing.Objects { internal class TestDataSource : IDataSource { private readonly Dictionary _kits; public TestDataSource(params ContentNodeKit[] kits) : this((IEnumerable) kits) { } public TestDataSource(IEnumerable kits) { _kits = kits.ToDictionary(x => x.Node.Id, x => x); } public ContentNodeKit GetContentSource(IScope scope, int id) => _kits.TryGetValue(id, out var kit) ? kit : default; public IEnumerable GetAllContentSources(IScope scope) => _kits.Values; public IEnumerable GetBranchContentSources(IScope scope, int id) { throw new NotImplementedException(); } public IEnumerable GetTypeContentSources(IScope scope, IEnumerable ids) => _kits.Values.Where(x => ids.Contains(x.ContentTypeId)); public ContentNodeKit GetMediaSource(IScope scope, int id) { throw new NotImplementedException(); } public IEnumerable GetAllMediaSources(IScope scope) { throw new NotImplementedException(); } public IEnumerable GetBranchMediaSources(IScope scope, int id) { throw new NotImplementedException(); } public IEnumerable GetTypeMediaSources(IScope scope, IEnumerable ids) { throw new NotImplementedException(); } } }