• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

DomCR / ACadSharp / 17737836230

15 Sep 2025 03:12PM UTC coverage: 2.092% (-76.2%) from 78.245%
17737836230

push

github

web-flow
Merge pull request #790 from DomCR/addflag-refactor

addflag refactor

141 of 9225 branches covered (1.53%)

Branch coverage included in aggregate %.

0 of 93 new or added lines in 10 files covered. (0.0%)

24910 existing lines in 372 files now uncovered.

724 of 32119 relevant lines covered (2.25%)

5.76 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/ACadSharp/Objects/Collections/GroupCollection.cs
1
using ACadSharp.Entities;
2
using System;
3
using System.Collections.Generic;
4
using System.Linq;
5
using System.Text.RegularExpressions;
6

7
namespace ACadSharp.Objects.Collections
8
{
9
        public class GroupCollection : ObjectDictionaryCollection<Group>
10
        {
UNCOV
11
                public GroupCollection(CadDictionary dictionary) : base(dictionary)
×
UNCOV
12
                {
×
UNCOV
13
                        this._dictionary = dictionary;
×
UNCOV
14
                }
×
15

16
                /// <inheritdoc/>
17
                public override void Add(Group entry)
UNCOV
18
                {
×
UNCOV
19
                        foreach (var e in entry.Entities)
×
UNCOV
20
                        {
×
UNCOV
21
                                if (e.Document != this._dictionary.Document)
×
UNCOV
22
                                {
×
UNCOV
23
                                        throw new InvalidOperationException("Entities in a group must be in the same document as the group being added.");
×
24
                                }
25
                        }
×
26

UNCOV
27
                        if (entry.IsUnnamed)
×
UNCOV
28
                        {
×
UNCOV
29
                                int next = 0;
×
UNCOV
30
                                foreach (Group group in this.Where(g => g.IsUnnamed))
×
31
                                {
×
32
                                        var num = int.Parse(Regex.Match(group.Name, @"\d+").Value);
×
33
                                        if (num > next)
×
34
                                        {
×
35
                                                next = num;
×
36
                                        }
×
37
                                }
×
38

UNCOV
39
                                entry.Name = $"*D{next++}";
×
UNCOV
40
                        }
×
41

UNCOV
42
                        base.Add(entry);
×
UNCOV
43
                }
×
44

45
                /// <summary>
46
                /// Creates a group with a collection of entities.
47
                /// </summary>
48
                /// <remarks>
49
                /// The entities must be assigned to the owner <see cref="CadDocument"/> of this collection.
50
                /// </remarks>
51
                /// <param name="entities"></param>
52
                /// <returns></returns>
53
                public Group CreateGroup(IEnumerable<Entity> entities)
54
                {
×
55
                        return this.CreateGroup(string.Empty, entities);
×
56
                }
×
57

58
                /// <summary>
59
                /// Creates a group with a collection of entities.
60
                /// </summary>
61
                /// <remarks>
62
                /// The entities must be assigned to the owner <see cref="CadDocument"/> of this collection.
63
                /// </remarks>
64
                /// <param name="name"></param>
65
                /// <param name="entities"></param>
66
                /// <returns></returns>
67
                public Group CreateGroup(string name, IEnumerable<Entity> entities)
UNCOV
68
                {
×
UNCOV
69
                        var group = new Group(name);
×
UNCOV
70
                        this.Add(group);
×
UNCOV
71
                        group.AddRange(entities);
×
UNCOV
72
                        return group;
×
UNCOV
73
                }
×
74
        }
75
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc