public void Should_roundtrip_enumerableproxy() { var enumerable = new EnumerableProxy <int?>(new int?[] { null, 1, 22, 333 }); var resurrected = Roundtrip(enumerable); resurrected.SequenceShouldBeEqual(enumerable); }
/// <summary> /// Retrieve the target enumerable wrapped in <paramref name="proxies"/>. /// </summary> /// <typeparam name="T"> /// Type of the enumerable elements. /// </typeparam> /// <param name="proxies"> /// An proxy enumerable returned by <see cref="GetProxy{T}(IEnumerable{T})"/>. /// </param> /// <returns> /// The target enumerable instance wrapped by <paramref name="proxies"/>, /// or <paramref name="proxies"/> itself if it is actually not a proxy. /// </returns> public static IEnumerable <T> GetTarget <T>(IEnumerable <T> proxies) where T : class { return(EnumerableProxy <T> .GetTarget(proxies)); }
/// <summary> /// Get an enumerable of proxies of the given <paramref name="targets"/>. /// </summary> /// <typeparam name="T"> /// Type of the enumerable elements. /// </typeparam> /// <param name="targets"> /// An enumerable of original target objects. /// </param> /// <returns> /// An enumerable of proxies of targets or targets itself if it is already /// an enumerable of others. /// </returns> public static IEnumerable <T> GetProxy <T>(IEnumerable <T> targets) where T : class { return(EnumerableProxy <T> .GetProxy(targets)); }