예제 #1
0
        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);
        }
예제 #2
0
 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;
     }
 }
예제 #3
0
 public void should_fail_if_not_a_array()
 {
     Assert.Throws <ArgumentException>(() => ArrayAdapter.Create(
                                           new SimpleValue(new object(), typeof(object).ToCachedType())));
 }