Beispiel #1
0
        public void SortedInsertation()
        {
            var pc = new PositionCollection();

            pc.Create(0, Bias.Forward);
            pc.Create(10, Bias.Backward);
            pc.Create(6, Bias.Backward);
            pc.Create(6, Bias.Forward);
            pc.Contents().Should().BeInAscendingOrder(new TextPositionComparer());
        }
Beispiel #2
0
        public void Insert_After()
        {
            var pc    = new PositionCollection();
            var start = pc.Create(5, Bias.Forward);
            var end   = pc.Create(10, Bias.Backward);

            pc.InsertAt(20, 10);
            start.Offset.Should().Be(5);
            end.Offset.Should().Be(10);
        }
Beispiel #3
0
        public void Remove_On_Start()
        {
            var pc    = new PositionCollection();
            var start = pc.Create(5, Bias.Forward);
            var end   = pc.Create(10, Bias.Backward);

            pc.RemoveAt(5, 2);

            start.Offset.Should().Be(5);
            end.Offset.Should().Be(8);
        }
Beispiel #4
0
        public void Insert_WithEmptyElement()
        {
            var pc         = new PositionCollection();
            var firstStart = pc.Create(5, Bias.Forward);
            var firstEnd   = pc.Create(10, Bias.Backward);

            var start = pc.Create(10, Bias.Forward);
            var end   = pc.Create(10, Bias.Backward);

            pc.InsertAt(10, 10);
            start.Offset.Should().Be(10);
            end.Offset.Should().Be(20);
            firstStart.Offset.Should().Be(5);
            firstEnd.Offset.Should().Be(20);
        }
Beispiel #5
0
        public void BiasForward_OnPos_Ignores()
        {
            var pc  = new PositionCollection();
            var end = pc.Create(10, Bias.Forward);

            pc.InsertAt(10, 10);

            end.Offset.Should().Be(10);
        }
Beispiel #6
0
        public void BiasForward_Before_Shifts()
        {
            var pc  = new PositionCollection();
            var end = pc.Create(10, Bias.Forward);

            pc.InsertAt(5, 10);

            end.Offset.Should().Be(20);
        }
Beispiel #7
0
        public void BiasBackward_After_Ignored()
        {
            var pc  = new PositionCollection();
            var end = pc.Create(10, Bias.Backward);

            pc.InsertAt(15, 10);

            end.Offset.Should().Be(10);
        }