示例#1
0
        public void ReduceCountStrings()
        {
            TextFileDataset ds     = new TextFileDataset("Files\\Lines.txt");
            var             result = ds.Map(s => 1).Reduce <int>((x, y) => x + y);

            Assert.IsNotNull(result);
            Assert.AreEqual(4, result);
        }
        public void MapConcat()
        {
            TextFileDataset ds = new TextFileDataset("Files\\Lines.txt");
            BaseDataset<string> mapds = ds.Map(i => i + "a");
            var enumerator = mapds.GetEnumerator();

            Assert.IsTrue(enumerator.MoveNext());
            Assert.AreEqual("fooa", enumerator.Current);

            Assert.IsTrue(enumerator.MoveNext());
            Assert.AreEqual("bara", enumerator.Current);

            Assert.IsTrue(enumerator.MoveNext());
            Assert.AreEqual("zooa", enumerator.Current);

            Assert.IsTrue(enumerator.MoveNext());
            Assert.AreEqual("wara", enumerator.Current);

            Assert.IsFalse(enumerator.MoveNext());
            Assert.AreEqual(4, ds.Count());
        }
示例#3
0
        public void MapConcat()
        {
            TextFileDataset   ds    = new TextFileDataset("Files\\Lines.txt");
            IDataset <string> mapds = ds.Map(i => i + "a");
            var enumerator          = mapds.GetEnumerator();

            Assert.IsTrue(enumerator.MoveNext());
            Assert.AreEqual("fooa", enumerator.Current);

            Assert.IsTrue(enumerator.MoveNext());
            Assert.AreEqual("bara", enumerator.Current);

            Assert.IsTrue(enumerator.MoveNext());
            Assert.AreEqual("zooa", enumerator.Current);

            Assert.IsTrue(enumerator.MoveNext());
            Assert.AreEqual("wara", enumerator.Current);

            Assert.IsFalse(enumerator.MoveNext());
            Assert.AreEqual(4, mapds.Count());
        }
        public void ReduceCountStrings()
        {
            TextFileDataset ds = new TextFileDataset("Files\\Lines.txt");
            var result = ds.Map(s => 1).Reduce<int>((x, y) => x + y);

            Assert.IsNotNull(result);
            Assert.AreEqual(4, result);
        }