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

DomCR / ACadSharp / 12905333403

22 Jan 2025 09:37AM UTC coverage: 75.991% (+0.007%) from 75.984%
12905333403

Pull #533

github

web-flow
Merge 0c450d5a1 into 8de195e0e
Pull Request #533: XData docs and utils

5282 of 7676 branches covered (68.81%)

Branch coverage included in aggregate %.

28 of 35 new or added lines in 4 files covered. (80.0%)

12 existing lines in 3 files now uncovered.

21087 of 27024 relevant lines covered (78.03%)

39136.05 hits per line

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

72.09
/src/ACadSharp/XData/ExtendedData.cs
1
using ACadSharp.Tables;
2
using System.Collections;
3
using System.Collections.Generic;
4
using System.Linq;
5

6
namespace ACadSharp.XData
7
{
8
        /// <summary>
9
        /// Extended data linked to an <see cref="AppId"/>.
10
        /// </summary>
11
        public class ExtendedData
12
        {
13
                /// <summary>
14
                /// Records contained in this Extended Data instance.
15
                /// </summary>
16
                public List<ExtendedDataRecord> Records { get; } = new();   //Should be private?
47,217✔
17

18
                /// <summary>
19
                /// Default constructor.
20
                /// </summary>
21
                public ExtendedData()
22,716✔
22
                {
22,716✔
23
                }
22,716✔
24

25
                /// <summary>
26
                /// Initialize an instance of <see cref="ExtendedData"/> with a collection of records.
27
                /// </summary>
28
                /// <param name="records">Records to add to the <see cref="ExtendedData"/>.</param>
29
                public ExtendedData(IEnumerable<ExtendedDataRecord> records) : this()
22,713✔
30
                {
22,713✔
31
                        this.Records.AddRange(records);
22,713✔
32
                }
22,713✔
33

34
                /// <summary>
35
                /// Make sure that the first and last record are <see cref="ExtendedDataControlString"/>.
36
                /// </summary>
37
                /// <remarks>
38
                /// The first control string must be the opening one and the last one closing.
39
                /// </remarks>
40
                public void AddControlStrings()
41
                {
2✔
42
                        if (!this.Records.Any())
2✔
43
                        {
1✔
44
                                this.Records.Add(ExtendedDataControlString.Open);
1✔
45
                                this.Records.Add(ExtendedDataControlString.Close);
1✔
46
                                return;
1✔
47
                        }
48

49
                        var first = this.Records.First();
1✔
50
                        if (first is not ExtendedDataControlString firstControl)
1!
51
                        {
1✔
52
                                this.Records.Insert(0, ExtendedDataControlString.Open);
1✔
53
                        }
1✔
NEW
54
                        else if (firstControl.IsClosing)
×
NEW
55
                        {
×
NEW
56
                                this.Records.Insert(0, ExtendedDataControlString.Open);
×
NEW
57
                        }
×
58

59
                        var last = this.Records.Last();
1✔
60
                        if (last is not ExtendedDataControlString lastControl)
1!
61
                        {
1✔
62
                                this.Records.Add(ExtendedDataControlString.Close);
1✔
63
                        }
1✔
NEW
64
                        else if (!lastControl.IsClosing)
×
NEW
65
                        {
×
NEW
66
                                this.Records.Add(ExtendedDataControlString.Close);
×
UNCOV
67
                        }
×
68
                }
2✔
69
        }
70
}
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