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

fluentassertions / fluentassertions.datasets / 12413638127

19 Dec 2024 01:27PM UTC coverage: 94.362%. First build
12413638127

Pull #5

github

web-flow
Merge e71ce3c7f into daac80f4c
Pull Request #5: GitHub actions

458 of 498 branches covered (91.97%)

Branch coverage included in aggregate %.

1266 of 1329 relevant lines covered (95.26%)

2324.28 hits per line

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

78.13
/Src/FluentAssertions.DataSets/Common/ReadOnlyNonGenericCollectionWrapper.cs
1
using System;
2
using System.Collections;
3
using System.Collections.Generic;
4
using System.Data;
5
using System.Linq;
6

7
namespace FluentAssertions.DataSets.Common;
8

9
internal static class ReadOnlyNonGenericCollectionWrapper
10
{
11
    public static ReadOnlyNonGenericCollectionWrapper<DataTableCollection, DataTable> Create(DataTableCollection collection)
12
    {
13
        return
32✔
14
            collection != null
32✔
15
                ? new ReadOnlyNonGenericCollectionWrapper<DataTableCollection, DataTable>(collection)
32✔
16
                : null;
32✔
17
    }
18

19
    public static ReadOnlyNonGenericCollectionWrapper<DataColumnCollection, DataColumn> Create(DataColumnCollection collection)
20
    {
21
        return
24✔
22
            collection != null
24✔
23
                ? new ReadOnlyNonGenericCollectionWrapper<DataColumnCollection, DataColumn>(collection)
24✔
24
                : null;
24✔
25
    }
26

27
    public static ReadOnlyNonGenericCollectionWrapper<DataRowCollection, DataRow> Create(DataRowCollection collection)
28
    {
29
        return
36✔
30
            collection != null
36✔
31
                ? new ReadOnlyNonGenericCollectionWrapper<DataRowCollection, DataRow>(collection)
36✔
32
                : null;
36✔
33
    }
34
}
35

36
internal class ReadOnlyNonGenericCollectionWrapper<TCollection, TItem> : ICollection<TItem>, ICollectionWrapper<TCollection>
37
    where TCollection : ICollection
38
{
39
    public TCollection UnderlyingCollection { get; }
68✔
40

41
    /// <summary>
42
    /// Initializes a new instance of the <see cref="ReadOnlyNonGenericCollectionWrapper{TCollection, TItem}"/> class.
43
    /// </summary>
44
    /// <exception cref="ArgumentNullException"><paramref name="collection"/> is <see langword="null"/>.</exception>
45
    public ReadOnlyNonGenericCollectionWrapper(TCollection collection)
76✔
46
    {
47
        Guard.ThrowIfArgumentIsNull(collection);
76✔
48

49
        UnderlyingCollection = collection;
76✔
50
    }
76✔
51

52
    public int Count => UnderlyingCollection.Count;
32✔
53

54
    bool ICollection<TItem>.IsReadOnly => true;
×
55

56
    public IEnumerator<TItem> GetEnumerator() => UnderlyingCollection.Cast<TItem>().GetEnumerator();
12✔
57

58
    IEnumerator IEnumerable.GetEnumerator() => UnderlyingCollection.GetEnumerator();
×
59

60
    public bool Contains(TItem item) => UnderlyingCollection.Cast<TItem>().Contains(item);
×
61

62
    public void CopyTo(TItem[] array, int arrayIndex) => UnderlyingCollection.CopyTo(array, arrayIndex);
×
63

64
    void ICollection<TItem>.Add(TItem item) => throw new NotSupportedException();
×
65

66
    void ICollection<TItem>.Clear() => throw new NotSupportedException();
×
67

68
    bool ICollection<TItem>.Remove(TItem item) => throw new NotSupportedException();
×
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

© 2025 Coveralls, Inc