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

DomCR / ACadSharp / 20263070764

16 Dec 2025 09:30AM UTC coverage: 77.723% (+0.03%) from 77.69%
20263070764

push

github

web-flow
Merge pull request #920 from DomCR/xrecord-dxf-fix

dxf xrecord

7595 of 10585 branches covered (71.75%)

Branch coverage included in aggregate %.

32 of 38 new or added lines in 5 files covered. (84.21%)

2 existing lines in 1 file now uncovered.

28129 of 35378 relevant lines covered (79.51%)

161834.67 hits per line

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

66.67
/src/ACadSharp/Objects/XRecord.Entry.cs
1
namespace ACadSharp.Objects
2
{
3
        public partial class XRecord
4
        {
5
                /// <summary>
6
                /// Represents a single data entry containing a group code, value, and associated owner within a <see cref="XRecord"/>.
7
                /// </summary>
8
                /// <remarks>The <see cref="Entry"/> class encapsulates a code-value pair, commonly used in CAD data
9
                /// structures to represent individual fields or properties. Each entry is associated with a group code that
10
                /// determines the type and interpretation of its value. The <see cref="Owner"/> property links the entry to its
11
                /// parent <see cref="XRecord"/>.</remarks>
12
                public class Entry
13
                {
14
                        /// <summary>
15
                        /// Gets the numeric code associated with the current instance.
16
                        /// </summary>
17
                        public int Code { get; }
21,850✔
18

19
                        /// <summary>
20
                        /// Gets or sets the value associated with the current instance.
21
                        /// </summary>
22
                        public object Value { get; set; }
4,568,250✔
23

24
                        public GroupCodeValueType GroupCode
25
                        {
26
                                get
27
                                {
10,870✔
28
                                        return GroupCodeValue.TransformValue(this.Code);
10,870✔
29
                                }
10,870✔
30
                        }
31

32
                        /// <summary>
33
                        /// Gets a value indicating whether this group code is associated with a linked object, such as a handle or object
34
                        /// ID.
35
                        /// </summary>
36
                        public bool HasLinkedObject
37
                        {
38
                                get
39
                                {
10✔
40
                                        switch (this.GroupCode)
10!
41
                                        {
42
                                                case GroupCodeValueType.Handle:
43
                                                case GroupCodeValueType.ObjectId:
44
                                                case GroupCodeValueType.ExtendedDataHandle:
45
                                                        return true;
10✔
46
                                                default:
47
                                                        return false;
×
48
                                        }
49
                                }
10✔
50
                        }
51

52
                        /// <summary>
53
                        /// Gets or sets the owner of the current record.
54
                        /// </summary>
55
                        public XRecord Owner { get; set; }
4,557,337✔
56

57
                        internal Entry(int code, object value, XRecord owner)
4,557,327✔
58
                        {
4,557,327✔
59
                                this.Code = code;
4,557,327✔
60
                                this.Value = value;
4,557,327✔
61
                                this.Owner = owner;
4,557,327✔
62
                        }
4,557,327✔
63

64
                        /// <summary>
65
                        /// Gets the referenced <see cref="CadObject"/> if one is linked and belongs to the same document as the owner.
66
                        /// </summary>
67
                        /// <returns>The referenced <see cref="CadObject"/> if a linked object exists and is associated with the same document as the
68
                        /// owner; otherwise, <see langword="null"/>.</returns>
69
                        public CadObject GetReference()
70
                        {
10✔
71
                                if (!this.HasLinkedObject)
10!
72
                                        return null;
×
73

74
                                if (this.Value is CadObject cadObject)
10!
75
                                {
10✔
76
                                        if (cadObject.Document != this.Owner.Document)
10!
77
                                        {
×
78
                                                return null;
×
79
                                        }
80

81
                                        return cadObject;
10✔
82
                                }
83
                                else
84
                                {
×
85
                                        return null;
×
86
                                }
87
                        }
10✔
88

89
                        /// <inheritdoc/>
90
                        public override string ToString()
91
                        {
×
NEW
92
                                return $"{this.Code}:{this.Value}";
×
93
                        }
×
94
                }
95
        }
96
}
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