mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-10 18:24:53 +00:00
Extension method for getting the immediate interfaces on a Type
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using ICD.Common.Utils.Extensions;
|
||||
using NUnit.Framework;
|
||||
@@ -93,6 +95,20 @@ namespace ICD.Common.Utils.Tests.Extensions
|
||||
Assert.IsTrue(baseTypes.Contains(typeof(object)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetImmediateInterfacesTest()
|
||||
{
|
||||
Type[] interfaces = typeof(ICollection<int>).GetImmediateInterfaces().ToArray();
|
||||
|
||||
Assert.AreEqual(1, interfaces.Length);
|
||||
Assert.AreEqual(typeof(IEnumerable<int>), interfaces[0]);
|
||||
|
||||
interfaces = typeof(IEnumerable<int>).GetImmediateInterfaces().ToArray();
|
||||
|
||||
Assert.AreEqual(1, interfaces.Length);
|
||||
Assert.AreEqual(typeof(IEnumerable), interfaces[0]);
|
||||
}
|
||||
|
||||
private interface C
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user