This commit is contained in:
Chris Cameron
2017-10-05 16:41:57 -04:00
parent eb24759580
commit 3b0bab02de
2 changed files with 197 additions and 169 deletions

View File

@@ -201,25 +201,19 @@ namespace ICD.Common.Utils.Tests.Extensions
[Test] [Test]
public void DictionaryEqualTest() public void DictionaryEqualTest()
{
Assert.Inconclusive();
}
[Test]
public void DictionaryEqualComparerTest()
{ {
Dictionary<int, int> a = new Dictionary<int, int> Dictionary<int, int> a = new Dictionary<int, int>
{ {
{1, 10}, {1, 10},
{2, 20}, {2, 20},
{ 3, 30 }, {3, 30}
}; };
Dictionary<int, int> b = new Dictionary<int, int> Dictionary<int, int> b = new Dictionary<int, int>
{ {
{1, 10}, {1, 10},
{2, 20}, {2, 20},
{ 3, 30 }, {3, 30}
}; };
Dictionary<int, int> c = new Dictionary<int, int> Dictionary<int, int> c = new Dictionary<int, int>
@@ -236,11 +230,41 @@ namespace ICD.Common.Utils.Tests.Extensions
} }
[Test] [Test]
public void DictionaryEqualFuncComparerTest() public void DictionaryEqualComparerTest()
{ {
Assert.Inconclusive(); Assert.Inconclusive();
} }
[Test]
public void DictionaryEqualFuncComparerTest()
{
Dictionary<int, int> a = new Dictionary<int, int>
{
{1, 10},
{2, 20},
{3, 30}
};
Dictionary<int, int> b = new Dictionary<int, int>
{
{1, 10},
{2, 20},
{3, 30}
};
Dictionary<int, int> c = new Dictionary<int, int>
{
{1, 10},
{2, 20}
};
Assert.IsTrue(a.DictionaryEqual(b, (left, right) => left / 10 == right / 10));
Assert.IsTrue(b.DictionaryEqual(a, (left, right) => left / 10 == right / 10));
Assert.IsFalse(a.DictionaryEqual(c, (left, right) => left / 10 == right / 10));
Assert.IsFalse(c.DictionaryEqual(a, (left, right) => left / 10 == right / 10));
}
[Test] [Test]
public void OrderByKeyTest() public void OrderByKeyTest()
{ {
@@ -248,7 +272,7 @@ namespace ICD.Common.Utils.Tests.Extensions
{ {
{1, 10}, {1, 10},
{2, 20}, {2, 20},
{ 3, 30 }, {3, 30}
}; };
KeyValuePair<int, int>[] ordered = a.OrderByKey().ToArray(); KeyValuePair<int, int>[] ordered = a.OrderByKey().ToArray();

View File

@@ -1,6 +1,7 @@
using NUnit.Framework; using NUnit.Framework;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using ICD.Common.Properties;
#if SIMPLSHARP #if SIMPLSHARP
using Crestron.SimplSharp.Reflection; using Crestron.SimplSharp.Reflection;
#else #else
@@ -12,16 +13,19 @@ namespace ICD.Common.Utils.Tests
[TestFixture] [TestFixture]
public sealed class ReflectionUtilsTest public sealed class ReflectionUtilsTest
{ {
[UsedImplicitly]
private string TestProperty { get; set; } private string TestProperty { get; set; }
[UsedImplicitly]
private void TestMethod(string param1, int param2) private void TestMethod(string param1, int param2)
{ {
} }
private class TestClass [UsedImplicitly]
private sealed class TestClass
{ {
public string Param1 { get; set; } public string Param1 { get; }
public int Param2 { get; set; } public int Param2 { get; }
public TestClass(string param1, int param2) public TestClass(string param1, int param2)
{ {