-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathReferenceCollectionMock.cs
More file actions
31 lines (27 loc) · 1.02 KB
/
ReferenceCollectionMock.cs
File metadata and controls
31 lines (27 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright (c) 2023, Phoenix Contact GmbH & Co. KG
// Licensed under the Apache License, Version 2.0
using System;
using System.Collections.Generic;
using Moryx.AbstractionLayer.Resources;
namespace Moryx.AbstractionLayer.TestTools
{
/// <summary>
/// Dummy implementation of a resource reference collection
/// </summary>
public class ReferenceCollectionMock<T> : List<T>, IReferenceCollection, IReferences<T>
where T : IResource
{
/// <inheritdoc />
public ICollection<IResource> UnderlyingCollection => new List<IResource>((IEnumerable<IResource>)this);
/// <inheritdoc />
public event EventHandler<ReferenceCollectionChangedEventArgs> CollectionChanged;
/// <summary>
/// Raise the <see cref="CollectionChanged"/> event
/// </summary>
/// <param name="eventArgs"></param>
public void RaiseCollectionChanged(ReferenceCollectionChangedEventArgs eventArgs)
{
CollectionChanged ?.Invoke(this, eventArgs);
}
}
}