public void should_return_object_if_it_implements_ilist() { var list = new List <string>(); IValue value = new SimpleValue(list, typeof(List <string>).ToCachedType()); ArrayAdapter.Create(value).ShouldBeSameAs(list); }
public EnumerableNode( Context context, string name, IValue enumerable, CachedMember member, INode parent, int?index = null) : base(name, enumerable, member, parent, context, index) { _list = new Lazy <IList>(() => enumerable.Instance.MapOrDefault(x => enumerable.ActualType.IsArray ? ArrayAdapter.Create(enumerable) : GenericListAdapter.Create(x))); if (SpecifiedType.IsGenericEnumerable) { _itemType = enumerable.SpecifiedType.GenericEnumerableType; } }
public void should_fail_if_not_a_array() { Assert.Throws <ArgumentException>(() => ArrayAdapter.Create( new SimpleValue(new object(), typeof(object).ToCachedType()))); }