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

fluentassertions / fluentassertions.datasets / 7436892764

07 Jan 2024 07:47AM UTC coverage: 94.435%. First build
7436892764

Pull #3

github

dennisdoomen
Update package references, refactor code, and fix namespace

Updated the package references in the csproj files. Refactored the code in several files to improve readability and maintainability. Also, fixed the namespace in the DataTableAssertionExtensions and DataRowAssertionExtensions classes to align with standard conventions. No functional changes were made.
Pull Request #3: Clean-up and finalization of data set support

440 of 480 branches covered (0.0%)

Branch coverage included in aggregate %.

1308 of 1371 relevant lines covered (95.4%)

2664.55 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