Exemplo n.º 1
0
            public void CollapsesNotSeparatedByTagOrProjectSpans()
            {
                var list = new ISpan[]
                {
                    new TextSpan("aa"),
                    new QueryTextSpan("bb", 1),
                    new ProjectSpan(1, "proj1", "red"),
                    new TextSpan("cc"),
                    new TagSpan(1, "tag1"),
                    new TextSpan("dd"),
                    new TextSpan("ee")
                };

                var collapsedList = list.CollapseTextSpans().ToList();

                collapsedList.Should().HaveCount(5);
                collapsedList[0].Should().BeOfType <QueryTextSpan>();
                ((QueryTextSpan)collapsedList[0]).Text.Should().Be("aabb");
                ((QueryTextSpan)collapsedList[0]).CursorPosition.Should().Be(3);
                collapsedList[1].Should().BeOfType <ProjectSpan>();
                collapsedList[2].Should().BeOfType <TextSpan>();
                ((TextSpan)collapsedList[2]).Text.Should().Be("cc");
                collapsedList[3].Should().BeOfType <TagSpan>();
                collapsedList[4].Should().BeOfType <TextSpan>();
                ((TextSpan)collapsedList[4]).Text.Should().Be("ddee");
            }
Exemplo n.º 2
0
            public void DoesNotCollapseProjectSpans()
            {
                var list = new ISpan[] { new ProjectSpan(1, "project1", "red"), new ProjectSpan(2, "project2", "green") };

                var collapsedList = list.CollapseTextSpans();

                collapsedList.AssertEqual(list);
            }
Exemplo n.º 3
0
            public void DoesNotCollapseTagSpans()
            {
                var list = new ISpan[] { new TagSpan(1, "tag1"), new TagSpan(2, "tag2") };

                var collapsedList = list.CollapseTextSpans();

                collapsedList.AssertEqual(list);
            }
Exemplo n.º 4
0
            public void CollapsesThreeTextSpansIntoOneTextSpan()
            {
                var list = new ISpan[] { new TextSpan("a"), new TextSpan("b"), new TextSpan("c") };

                var collapsedList = list.CollapseTextSpans().ToList();

                collapsedList.Should().HaveCount(1);
                collapsedList.First().IsTextSpan().Should().BeTrue();
                ((TextSpan)collapsedList.First()).Text.Should().Be("abc");
            }
Exemplo n.º 5
0
            public void CollapsesQueryTextSpanAndMultipleTextSpanIntoQueryTextSpan()
            {
                var list = new ISpan[] { new TextSpan("aa"), new QueryTextSpan("bb", 1), new TextSpan("cc"), new TextSpan("dd") };

                var collapsedList = list.CollapseTextSpans().ToList();

                collapsedList.Should().HaveCount(1);
                collapsedList.First().IsTextSpan().Should().BeTrue();
                var queryTextSpan = (QueryTextSpan)collapsedList.First();

                queryTextSpan.Text.Should().Be("aabbccdd");
                queryTextSpan.CursorPosition.Should().Be(3);
            }