Exemplo n.º 1
0
        public void Expand_GivenCollectionProcessor_UpdatesWithAllBindings( )
        {
            var initial    = List(typeof(int));
            var expected   = new[] { List(typeof(Tuple <int>)), List(typeof(Tuple <int>)) };
            var collection = new BindingCollection(initial);

            collection.Expand(Enumerable.Repeat(1, 2), (bs, i) => bs.Reduce(b => List(typeof(Tuple <>).MakeGenericType(b.Value.Type))));
            var actual = collection.ToArray( );

            Assert.Equal(actual, expected);
        }
Exemplo n.º 2
0
        public void Reduce_GivenCollectionProcessor_UpdatesAllBindings( )
        {
            var initial    = List(typeof(int));
            var expected   = new[] { List(typeof(Tuple <int>)) };
            var collection = new BindingCollection(initial);

            collection.Reduce((b) => new[] { List(typeof(Tuple <>).MakeGenericType(b.Value.Type)) });
            var actual = collection.ToArray( );

            Assert.Equal(actual, expected);
        }
Exemplo n.º 3
0
        public void Reduce_GivenItemProcessor_RemovesBindingsWhenProcessorReturnsNull( )
        {
            var initial    = new[] { List(typeof(int)), List(typeof(double)) };
            var expected   = new[] { initial[1] };
            var collection = new BindingCollection(initial);

            collection.Reduce(Enumerable.Repeat(1, 2), (b, i) => i == 1 && b.Value.Type == typeof(int) ? null : b);
            var actual = collection.ToArray( );

            Assert.Equal(actual, expected);
        }
Exemplo n.º 4
0
        public void Reduce_GivenCollectionProcessor_UpdatesBindingsAgainstAllInputs( )
        {
            var initial    = List(typeof(int));
            var expected   = new[] { List(typeof(Tuple <Tuple <int> >)) };
            var collection = new BindingCollection(initial);

            collection.Reduce(Enumerable.Repeat(1, 2), (b, i) => new[] { List(typeof(Tuple <>).MakeGenericType(b.Value.Type)) });
            var actual = collection.ToArray( );

            Assert.Equal(actual, expected);
        }
Exemplo n.º 5
0
        public void ctor_GivenMultipleBindings_InitializesCollectionWithBindings( )
        {
            var a        = List(typeof(int));
            var b        = List(typeof(double));
            var c        = List(typeof(DateTime));
            var expected = new[] { a, b, c };

            var collection = new BindingCollection(expected);
            var actual     = collection.ToArray( );

            Assert.Equal(actual, expected);
        }