Merge remote-tracking branch 'origin/dev' into RoutingOp

This commit is contained in:
Chris Cameron
2018-01-09 14:23:19 -05:00
4 changed files with 19 additions and 19 deletions

View File

@@ -234,7 +234,7 @@ namespace ICD.Common.Utils.Tests.Extensions
[Test] [Test]
public void PrependManyTest() public void PrependManyTest()
{ {
int[] values = (new[] {4, 5, 6}).PrependMany(1, 2, 3).ToArray(); int[] values = new[] {4, 5, 6}.PrependMany(1, 2, 3).ToArray();
Assert.AreEqual(6, values.Length); Assert.AreEqual(6, values.Length);
Assert.AreEqual(1, values[0]); Assert.AreEqual(1, values[0]);
@@ -256,7 +256,7 @@ namespace ICD.Common.Utils.Tests.Extensions
[Test] [Test]
public void AppendManyTest() public void AppendManyTest()
{ {
int[] values = (new[] {1, 2, 3}).AppendMany(4, 5, 6).ToArray(); int[] values = new[] {1, 2, 3}.AppendMany(4, 5, 6).ToArray();
Assert.AreEqual(6, values.Length); Assert.AreEqual(6, values.Length);
Assert.AreEqual(1, values[0]); Assert.AreEqual(1, values[0]);
@@ -270,7 +270,7 @@ namespace ICD.Common.Utils.Tests.Extensions
[Test] [Test]
public void OrderTest() public void OrderTest()
{ {
int[] values = (new[] {2, 3, 1}).Order().ToArray(); int[] values = new[] {2, 3, 1}.Order().ToArray();
Assert.AreEqual(3, values.Length); Assert.AreEqual(3, values.Length);
Assert.AreEqual(1, values[0]); Assert.AreEqual(1, values[0]);
@@ -281,7 +281,7 @@ namespace ICD.Common.Utils.Tests.Extensions
[Test] [Test]
public void ExceptTest() public void ExceptTest()
{ {
int[] values = (new[] {1, 2, 3}).Except(2).ToArray(); int[] values = new[] {1, 2, 3}.Except(2).ToArray();
Assert.AreEqual(2, values.Length); Assert.AreEqual(2, values.Length);
Assert.AreEqual(1, values[0]); Assert.AreEqual(1, values[0]);
@@ -309,7 +309,7 @@ namespace ICD.Common.Utils.Tests.Extensions
[Test] [Test]
public void ToHashSetTest() public void ToHashSetTest()
{ {
IcdHashSet<int> values = EnumerableExtensions.ToHashSet(new[] {1, 2, 3}); IcdHashSet<int> values = new[] {1, 2, 3}.ToIcdHashSet();
Assert.AreEqual(3, values.Count); Assert.AreEqual(3, values.Count);
Assert.IsTrue(values.Contains(1)); Assert.IsTrue(values.Contains(1));
@@ -320,7 +320,7 @@ namespace ICD.Common.Utils.Tests.Extensions
[Test] [Test]
public void ToDictionaryIntTest() public void ToDictionaryIntTest()
{ {
Dictionary<int, int> values = (new[] {1, 2, 3}).ToDictionary(); Dictionary<int, int> values = new[] {1, 2, 3}.ToDictionary();
Assert.AreEqual(3, values.Count); Assert.AreEqual(3, values.Count);
Assert.AreEqual(1, values[0]); Assert.AreEqual(1, values[0]);
@@ -331,7 +331,7 @@ namespace ICD.Common.Utils.Tests.Extensions
[Test] [Test]
public void ToDictionaryUIntTest() public void ToDictionaryUIntTest()
{ {
Dictionary<uint, int> values = (new[] {1, 2, 3}).ToDictionaryUInt(); Dictionary<uint, int> values = new[] {1, 2, 3}.ToDictionaryUInt();
Assert.AreEqual(3, values.Count); Assert.AreEqual(3, values.Count);
Assert.AreEqual(1, values[0]); Assert.AreEqual(1, values[0]);
@@ -360,24 +360,24 @@ namespace ICD.Common.Utils.Tests.Extensions
[Test] [Test]
public void UnanimousTest() public void UnanimousTest()
{ {
Assert.IsTrue((new[] {true, true, true}).Unanimous()); Assert.IsTrue(new[] {true, true, true}.Unanimous());
Assert.IsTrue((new[] {false, false, false}).Unanimous()); Assert.IsTrue(new[] {false, false, false}.Unanimous());
Assert.IsFalse((new[] {false, true, false}).Unanimous()); Assert.IsFalse(new[] {false, true, false}.Unanimous());
Assert.IsFalse((new bool[] { }).Unanimous()); Assert.IsFalse(new bool[] { }.Unanimous());
} }
[Test] [Test]
public void UnanimousOtherTest() public void UnanimousOtherTest()
{ {
Assert.AreEqual("A", (new[] {"A", "A", "A"}).Unanimous("B")); Assert.AreEqual("A", new[] {"A", "A", "A"}.Unanimous("B"));
Assert.AreEqual("C", (new[] {"B", "A", "B"}).Unanimous("C")); Assert.AreEqual("C", new[] {"B", "A", "B"}.Unanimous("C"));
Assert.AreEqual("A", (new string[] { }).Unanimous("A")); Assert.AreEqual("A", new string[] { }.Unanimous("A"));
} }
[Test] [Test]
public void PartitionTest() public void PartitionTest()
{ {
int[][] items = (new[] {1, 2, 3, 4, 5, 6, 7, 8}).Partition(3) int[][] items = new[] {1, 2, 3, 4, 5, 6, 7, 8}.Partition(3)
.Select(p => p.ToArray()) .Select(p => p.ToArray())
.ToArray(); .ToArray();

View File

@@ -118,7 +118,7 @@ namespace ICD.Common.Utils.Attributes.Rpc
BindingFlags.Instance) BindingFlags.Instance)
.Where(m => ReflectionExtensions.GetCustomAttributes<RpcAttribute>(m, true) .Where(m => ReflectionExtensions.GetCustomAttributes<RpcAttribute>(m, true)
.Any(a => a.m_Key == key)) .Any(a => a.m_Key == key))
.ToHashSet(); .ToIcdHashSet();
} }
return s_MethodCache[clientType][key]; return s_MethodCache[clientType][key];
@@ -161,7 +161,7 @@ namespace ICD.Common.Utils.Attributes.Rpc
BindingFlags.Instance) BindingFlags.Instance)
.Where(p => p.CanWrite && ReflectionExtensions.GetCustomAttributes<RpcAttribute>(p, true) .Where(p => p.CanWrite && ReflectionExtensions.GetCustomAttributes<RpcAttribute>(p, true)
.Any(a => a.m_Key == key)) .Any(a => a.m_Key == key))
.ToHashSet(); .ToIcdHashSet();
} }
return s_PropertyCache[clientType][key]; return s_PropertyCache[clientType][key];

View File

@@ -119,7 +119,7 @@ namespace ICD.Common.Utils
// Reflection is slow and this method is called a lot, so we cache the results. // Reflection is slow and this method is called a lot, so we cache the results.
if (!s_EnumValuesCache.ContainsKey(type)) if (!s_EnumValuesCache.ContainsKey(type))
s_EnumValuesCache[type] = GetValuesUncached(type).ToHashSet(); s_EnumValuesCache[type] = GetValuesUncached(type).ToIcdHashSet();
return s_EnumValuesCache[type]; return s_EnumValuesCache[type];
} }

View File

@@ -496,7 +496,7 @@ namespace ICD.Common.Utils.Extensions
/// <typeparam name="T"></typeparam> /// <typeparam name="T"></typeparam>
/// <param name="extends"></param> /// <param name="extends"></param>
/// <returns></returns> /// <returns></returns>
public static IcdHashSet<T> ToHashSet<T>(this IEnumerable<T> extends) public static IcdHashSet<T> ToIcdHashSet<T>(this IEnumerable<T> extends)
{ {
if (extends == null) if (extends == null)
throw new ArgumentNullException("extends"); throw new ArgumentNullException("extends");