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

DomCR / ACadSharp / 12905441053

22 Jan 2025 09:44AM UTC coverage: 75.98% (-0.004%) from 75.984%
12905441053

Pull #533

github

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

5281 of 7676 branches covered (68.8%)

Branch coverage included in aggregate %.

18 of 26 new or added lines in 2 files covered. (69.23%)

6 existing lines in 1 file now uncovered.

21084 of 27024 relevant lines covered (78.02%)

39134.7 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.Generic;
3
using System.Linq;
4

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

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

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

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

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

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