Exemplo n.º 1
0
        public void ExtendTest3()
        {
            var payload   = StructTuple.Create("A", 3);
            var inputList = new[]
            {
                StreamEvent.CreateInterval(1, 5, payload),
                StreamEvent.CreateInterval(2, 10, payload),
                StreamEvent.CreateInterval(3, 8, payload),
                StreamEvent.CreateInterval(4, 6, payload),
                StreamEvent.CreateInterval(8, 9, payload),
            };

            var compareTo = new StreamEvent <StructTuple <string, int> >[]
            {
                StreamEvent.CreateInterval(1, 15, payload),
                StreamEvent.CreateInterval(2, 20, payload),
                StreamEvent.CreateInterval(3, 18, payload),
                StreamEvent.CreateInterval(4, 16, payload),
                StreamEvent.CreateInterval(8, 19, payload),
                END2
            };

            var input        = inputList.ToList().ToObservable().ToStreamable();
            var outputStream = input.ExtendLifetime(10);

            Assert.IsTrue(outputStream.Select(r => r.Item1).IsEquivalentTo(compareTo.Select(r => r.IsData ? StreamEvent.CreateInterval(r.SyncTime, r.OtherTime, r.Payload.Item1) : END).ToArray()));
        }
Exemplo n.º 2
0
        public void PointAtEndTest5()
        {
            var payload   = StructTuple.Create("A", 3);
            var inputList = new[]
            {
                StreamEvent.CreateInterval(1, 5, payload),
                StreamEvent.CreateInterval(2, 10, payload),
                StreamEvent.CreateInterval(3, 8, payload),
                StreamEvent.CreateInterval(4, 6, payload),
                StreamEvent.CreateInterval(8, 9, payload),
            };

            var compareTo = new StreamEvent <StructTuple <string, int> >[]
            {
                StreamEvent.CreatePoint(5, payload),
                StreamEvent.CreatePoint(6, payload),
                StreamEvent.CreatePoint(8, payload),
                StreamEvent.CreatePoint(9, payload),
                StreamEvent.CreatePoint(10, payload),
                END2
            };

            var input        = inputList.ToList().ToObservable().ToStreamable();
            var outputStream = input.PointAtEnd();

            Assert.IsTrue(outputStream.Select(r => r.Item1).IsEquivalentTo(compareTo.Select(r => r.IsData ? StreamEvent.CreatePoint(r.SyncTime, r.Payload.Item1) : END).ToArray()));
        }
Exemplo n.º 3
0
        public void PointAtEndTest6()
        {
            var payload   = StructTuple.Create("A", 3);
            var inputList = new[]
            {
                StreamEvent.CreateStart(1, payload),
                StreamEvent.CreateEnd(2, 1, payload),
                StreamEvent.CreateStart(2, payload),
                StreamEvent.CreateEnd(3, 2, payload),
                StreamEvent.CreateStart(3, payload),
                StreamEvent.CreateEnd(4, 3, payload),
                StreamEvent.CreateStart(4, payload),
                StreamEvent.CreateEnd(5, 4, payload)
            };

            var compareTo = new StreamEvent <StructTuple <string, int> >[]
            {
                StreamEvent.CreatePoint(101, payload),
                StreamEvent.CreatePoint(102, payload),
                StreamEvent.CreatePoint(103, payload),
                StreamEvent.CreatePoint(104, payload),
                END2
            };

            var input = inputList.ToList().ToObservable().ToStreamable()
                        .AlterEventDuration(100);
            var outputStream = input.PointAtEnd();

            Assert.IsTrue(outputStream.Select(r => r.Item1).IsEquivalentTo(compareTo.Select(r => r.IsData ? StreamEvent.CreatePoint(r.SyncTime, r.Payload.Item1) : END).ToArray()));
        }
Exemplo n.º 4
0
        public void PointAtEndTest4()
        {
            var payload = StructTuple.Create("A", 3);
            // nothing interesting happens here
            var inputList = new[] {
                StreamEvent.CreateStart(1, payload),
                StreamEvent.CreateEnd(2, 1, payload),
                StreamEvent.CreateStart(2, payload),
                StreamEvent.CreateEnd(3, 2, payload),
                StreamEvent.CreateStart(3, payload),
                StreamEvent.CreateEnd(4, 3, payload),
                StreamEvent.CreateStart(4, payload),
                StreamEvent.CreateEnd(5, 4, payload)
            };

            var compareTo = new StreamEvent <StructTuple <string, int> >[] {
                StreamEvent.CreatePoint(2, payload),
                StreamEvent.CreatePoint(3, payload),
                StreamEvent.CreatePoint(4, payload),
                StreamEvent.CreatePoint(5, payload),
                END2
            };

            var input        = inputList.ToList().ToObservable().ToStreamable().SetProperty().IsIntervalFree(true);
            var outputStream = input.PointAtEnd();

            Assert.IsTrue(outputStream.Select(r => r.Item1).IsEquivalentTo(compareTo.Select(r => r.IsData ? StreamEvent.CreatePoint(r.SyncTime, r.Payload.Item1) : END).ToArray()));
        }