Beispiel #1
0
        public void Clear()
        {
            lock (_lockObj) {
                foreach (var tag in _tags)
                {
                    RemovedTags.Enqueue(tag);
                }

                _tags.Clear();
            }
        }
        public void TextRangeCollection_ClearTest()
        {
            TextRange[] ranges = new TextRange[3];

            ranges[0] = TextRange.FromBounds(1, 2);
            ranges[1] = TextRange.FromBounds(3, 5);
            ranges[2] = TextRange.FromBounds(5, 7);

            TextRangeCollection <TextRange> target = new TextRangeCollection <TextRange>();

            target.Count.Should().Be(0);
            target.Start.Should().Be(0);
            target.End.Should().Be(0);
            target.Length.Should().Be(0);

            target.Clear();

            target.Count.Should().Be(0);
            target.Start.Should().Be(0);
            target.End.Should().Be(0);
            target.Length.Should().Be(0);

            target.Add(ranges);

            target.Count.Should().Be(3);
            target.Start.Should().Be(1);
            target.End.Should().Be(7);
            target.Length.Should().Be(6);

            target.Clear();

            target.Count.Should().Be(0);
            target.Start.Should().Be(0);
            target.End.Should().Be(0);
            target.Length.Should().Be(0);
        }
        public void TextRangeCollection_ClearTest() {
            TextRange[] ranges = new TextRange[3];

            ranges[0] = TextRange.FromBounds(1, 2);
            ranges[1] = TextRange.FromBounds(3, 5);
            ranges[2] = TextRange.FromBounds(5, 7);

            TextRangeCollection<TextRange> target = new TextRangeCollection<TextRange>();

            target.Count.Should().Be(0);
            target.Start.Should().Be(0);
            target.End.Should().Be(0);
            target.Length.Should().Be(0);

            target.Clear();

            target.Count.Should().Be(0);
            target.Start.Should().Be(0);
            target.End.Should().Be(0);
            target.Length.Should().Be(0);

            target.Add(ranges);

            target.Count.Should().Be(3);
            target.Start.Should().Be(1);
            target.End.Should().Be(7);
            target.Length.Should().Be(6);

            target.Clear();

            target.Count.Should().Be(0);
            target.Start.Should().Be(0);
            target.End.Should().Be(0);
            target.Length.Should().Be(0);
        }