コード例 #1
0
        public void FlatMapValues_ReturnsNewKStream()
        {
            var observable = Observable.Return(DEFAULT_KEY_VALUE_PAIR);
            var testObject = new KStream <Unit, Unit>(observable);
            var actual     = testObject.FlatMapValues(x => new[] { x });

            Assert.NotSame(testObject, actual);
        }
コード例 #2
0
        public async void FlatMapValues_AppliesProcessorToStream()
        {
            var observable = Observable.Return(KeyValuePair.Create(Unit.Default, "3"));
            var testObject = new KStream <Unit, string>(observable);

            var expected = new[] {
                KeyValuePair.Create(Unit.Default, 1),
                KeyValuePair.Create(Unit.Default, 2),
                KeyValuePair.Create(Unit.Default, 3)
            };

            var actual = await testObject
                         .FlatMapValues(x => Enumerable.Range(1, int.Parse(x)))
                         .ToObservable()
                         .ToList().SingleAsync();

            Assert.Equal(expected, actual);
        }