Esempio n. 1
0
        public void CardinalityOfStream()
        {
            var collection = Enumerable.Range(0, 1000);

            var collectionStream = new StreamableSource <int>();

            var results = new List <int>();

            // #TODO, build expression tree and optimize
            // Expression<Action<Streamable<int>>> expression = collectionStream =>
            //

            // Build a pipeline from the collection stream.
            //
            collectionStream
            .CardinalityEstimate(_ => _, 0.1);

            collectionStream.Publish(collection);

            // var expected = Enumerable.Range(0, 20).Select(r => r * 5);

            // #TODO obtain results from the collectionStream
            //
            collectionStream.Inspect();

            // Assert.Equal(expected, results);
        }
Esempio n. 2
0
        public void MinOnBuffer()
        {
            var collection = Enumerable.Range(0, 100);

            var collectionStream = new StreamableSource <int>();

            var results = new List <int>();

            // #TODO, build expression tree and optimize
            // Expression<Action<Streamable<int>>> expression = collectionStream =>
            //

            // Build a pipeline from the collection stream.
            //
            collectionStream
            .Buffer(5)
            .Min()
            .Consume(r =>
                     results.Add(r));

            collectionStream.Publish(collection);

            var expected = Enumerable.Range(0, 20).Select(r => r * 5);

            // #TODO obtain results from the collectionStream
            //
            collectionStream.Inspect();

            Assert.Equal(expected, results);
        }