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

DomCR / ACadSharp / 25418591804

06 May 2026 05:42AM UTC coverage: 76.814% (+0.01%) from 76.804%
25418591804

push

github

web-flow
Merge pull request #1062 from DomCR/issue-897_sortents-refactor

issue-897 Refactor SortEntitiesTable

8576 of 12103 branches covered (70.86%)

Branch coverage included in aggregate %.

88 of 103 new or added lines in 3 files covered. (85.44%)

11 existing lines in 3 files now uncovered.

30769 of 39118 relevant lines covered (78.66%)

152821.67 hits per line

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

69.23
/src/ACadSharp/Objects/SortEntitiesTable.Sorter.cs
1
using ACadSharp.Attributes;
2
using ACadSharp.Entities;
3

4
namespace ACadSharp.Objects;
5

6
public partial class SortEntitiesTable
7
{
8
        /// <summary>
9
        /// Entity sorter based in their position in the collection.
10
        /// </summary>
11
        public class Sorter : System.IComparable<Sorter>
12
        {
13
                /// <summary>
14
                /// Sorter handle, if this doesn't point to an entity, the value will match with <see cref="Entity"/>'s handle.
15
                /// </summary>
16
                [DxfCodeValue(5)]
17
                public ulong SortHandle { get; set; }
3,692✔
18

19
                /// <summary>
20
                /// Entity to set the order to.
21
                /// </summary>
22
                [DxfCodeValue(331)]
23
                public Entity Entity { get; set; }
3,003✔
24

25
                /// <summary>
26
                /// Sorter constructor with the entity and handle.
27
                /// </summary>
28
                /// <param name="entity">Entity in the block to be sorted.</param>
29
                /// <param name="handle">Sorter handle.</param>
30
                public Sorter(Entity entity, ulong handle)
2,793✔
31
                {
2,793✔
32
                        this.Entity = entity;
2,793✔
33
                        this.SortHandle = handle;
2,793✔
34
                }
2,793✔
35

36
                /// <inheritdoc/>
37
                public override string ToString()
NEW
38
                {
×
NEW
39
                        return $"{this.SortHandle} | {this.Entity?.ToString()}";
×
NEW
40
                }
×
41

42
                /// <inheritdoc/>
43
                public int CompareTo(Sorter other)
44
                {
227✔
45
                        if (this.SortHandle < other.SortHandle)
227✔
46
                        {
115✔
47
                                return -1;
115✔
48
                        }
49
                        else if (this.SortHandle > other.SortHandle)
112!
50
                        {
112✔
51
                                return 1;
112✔
52
                        }
53
                        else
UNCOV
54
                        {
×
NEW
55
                                return 0;
×
56
                        }
57
                }
227✔
58
        }
59
}
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