Exemplo n.º 1
0
        public void TestFlow()
        {
            // Lookup from s0
            Cursor[] cursors = Read(_repository.GetCursors(0));
            Assert.AreEqual(1, cursors.Length);

            ICollection <EventBean> resultsS1 = SupportJoinResultNodeFactory.MakeEventSet(2);

            _repository.AddResult(cursors[0], resultsS1, 1);

            // Lookup from s1
            cursors = Read(_repository.GetCursors(1));
            Assert.AreEqual(2, cursors.Length);

            ICollection <EventBean>[] resultsS2 = SupportJoinResultNodeFactory.MakeEventSets(new[] { 2, 3 });
            _repository.AddResult(cursors[0], resultsS2[0], 2);
            _repository.AddResult(cursors[1], resultsS2[1], 2);

            // Lookup from s2
            cursors = Read(_repository.GetCursors(2));
            Assert.AreEqual(5, cursors.Length); // 2 + 3 for s2

            ICollection <EventBean>[] resultsS3 = SupportJoinResultNodeFactory.MakeEventSets(new[] { 2, 1, 3, 5, 1 });
            _repository.AddResult(cursors[0], resultsS3[0], 3);
            _repository.AddResult(cursors[1], resultsS3[1], 3);
            _repository.AddResult(cursors[2], resultsS3[2], 3);
            _repository.AddResult(cursors[3], resultsS3[3], 3);
            _repository.AddResult(cursors[4], resultsS3[4], 3);

            // Lookup from s3
            cursors = Read(_repository.GetCursors(3));
            Assert.AreEqual(12, cursors.Length);
        }
Exemplo n.º 2
0
        public void TestAddResult()
        {
            ICollection <EventBean> results = SupportJoinResultNodeFactory.MakeEventSet(2);

            _repository.AddResult(_repository.GetCursors(0).Advance(), results, 1);
            Assert.AreEqual(1, _repository.NodesPerStream[1].Count);

            try {
                _repository.AddResult(_repository.GetCursors(0).Advance(), new HashSet <EventBean>(), 1);
                Assert.Fail();
            }
            catch (ArgumentException) {
                // expected
            }
            try {
                _repository.AddResult(_repository.GetCursors(0).Advance(), null, 1);
                Assert.Fail();
            }
            catch (NullReferenceException) {
                // expected
            }
        }