mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-01-11 19:44:55 +00:00
Tidying
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
using ICD.Common.Utils.Extensions;
|
using System.Collections.Generic;
|
||||||
using NUnit.Framework;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using ICD.Common.Utils.Extensions;
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
namespace ICD.Common.Utils.Tests.Extensions
|
namespace ICD.Common.Utils.Tests.Extensions
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
using ICD.Common.Utils.Collections;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using ICD.Common.Utils.Collections;
|
||||||
using ICD.Common.Utils.Extensions;
|
using ICD.Common.Utils.Extensions;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace ICD.Common.Utils.Tests.Extensions
|
namespace ICD.Common.Utils.Tests.Extensions
|
||||||
{
|
{
|
||||||
@@ -117,8 +117,8 @@ namespace ICD.Common.Utils.Tests.Extensions
|
|||||||
[Test]
|
[Test]
|
||||||
public void SequenceEqualTest()
|
public void SequenceEqualTest()
|
||||||
{
|
{
|
||||||
int[] a = new[] {1, 2, 3, 4};
|
int[] a = {1, 2, 3, 4};
|
||||||
int[] b = new[] {1, 4, 9, 16};
|
int[] b = {1, 4, 9, 16};
|
||||||
|
|
||||||
Assert.IsFalse(a.SequenceEqual(b, (x, y) => x == y));
|
Assert.IsFalse(a.SequenceEqual(b, (x, y) => x == y));
|
||||||
Assert.IsTrue(a.SequenceEqual(b, (x, y) => x * x == y));
|
Assert.IsTrue(a.SequenceEqual(b, (x, y) => x * x == y));
|
||||||
@@ -508,7 +508,7 @@ namespace ICD.Common.Utils.Tests.Extensions
|
|||||||
[Test]
|
[Test]
|
||||||
public void ConsolidateTest()
|
public void ConsolidateTest()
|
||||||
{
|
{
|
||||||
string[] sequence = EnumerableExtensions.Consolidate(new[] {"A", "B", "B", "C"}).ToArray();
|
string[] sequence = new[] {"A", "B", "B", "C"}.Consolidate().ToArray();
|
||||||
|
|
||||||
Assert.AreEqual(3, sequence.Length, StringUtils.ArrayFormat(sequence));
|
Assert.AreEqual(3, sequence.Length, StringUtils.ArrayFormat(sequence));
|
||||||
Assert.AreEqual("A", sequence[0]);
|
Assert.AreEqual("A", sequence[0]);
|
||||||
@@ -519,7 +519,7 @@ namespace ICD.Common.Utils.Tests.Extensions
|
|||||||
[Test]
|
[Test]
|
||||||
public void ConsolidateComparerTest()
|
public void ConsolidateComparerTest()
|
||||||
{
|
{
|
||||||
string[] sequence = EnumerableExtensions.Consolidate(new[] {"A", "B", "B", "C"}, Comparer<string>.Default).ToArray();
|
string[] sequence = new[] {"A", "B", "B", "C"}.Consolidate(Comparer<string>.Default).ToArray();
|
||||||
|
|
||||||
Assert.AreEqual(3, sequence.Length, StringUtils.ArrayFormat(sequence));
|
Assert.AreEqual(3, sequence.Length, StringUtils.ArrayFormat(sequence));
|
||||||
Assert.AreEqual("A", sequence[0]);
|
Assert.AreEqual("A", sequence[0]);
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System;
|
using NUnit.Framework;
|
||||||
using NUnit.Framework;
|
|
||||||
|
|
||||||
namespace ICD.Common.Utils.Tests.Extensions
|
namespace ICD.Common.Utils.Tests.Extensions
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ namespace ICD.Common.Utils.Tests.Extensions
|
|||||||
{
|
{
|
||||||
using (JsonWriter writer = new JsonTextWriter(stringWriter))
|
using (JsonWriter writer = new JsonTextWriter(stringWriter))
|
||||||
{
|
{
|
||||||
serializer.SerializeArray(writer, new int[] {1, 2, 3, 4});
|
serializer.SerializeArray(writer, new[] {1, 2, 3, 4});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ namespace ICD.Common.Utils.Tests.Extensions
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.IsTrue(deserialized.SequenceEqual(new int[] {1, 2, 3, 4}));
|
Assert.IsTrue(deserialized.SequenceEqual(new[] {1, 2, 3, 4}));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using ICD.Common.Utils.Extensions;
|
using System.Collections.Generic;
|
||||||
using NUnit.Framework;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using ICD.Common.Utils.Extensions;
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
namespace ICD.Common.Utils.Tests.Extensions
|
namespace ICD.Common.Utils.Tests.Extensions
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using NUnit.Framework;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using ICD.Common.Utils.Extensions;
|
using ICD.Common.Utils.Extensions;
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
namespace ICD.Common.Utils.Tests.Extensions
|
namespace ICD.Common.Utils.Tests.Extensions
|
||||||
{
|
{
|
||||||
@@ -12,7 +12,7 @@ namespace ICD.Common.Utils.Tests.Extensions
|
|||||||
{
|
{
|
||||||
Queue<int> queue = new Queue<int>();
|
Queue<int> queue = new Queue<int>();
|
||||||
|
|
||||||
queue.EnqueueRange(new int[] { 1, 2, 3 });
|
queue.EnqueueRange(new[] { 1, 2, 3 });
|
||||||
|
|
||||||
Assert.AreEqual(3, queue.Count);
|
Assert.AreEqual(3, queue.Count);
|
||||||
Assert.AreEqual(1, queue.Dequeue());
|
Assert.AreEqual(1, queue.Dequeue());
|
||||||
@@ -24,7 +24,7 @@ namespace ICD.Common.Utils.Tests.Extensions
|
|||||||
public void DequeueTest()
|
public void DequeueTest()
|
||||||
{
|
{
|
||||||
Queue<int> queue = new Queue<int>();
|
Queue<int> queue = new Queue<int>();
|
||||||
queue.EnqueueRange(new int[] { 1, 2, 3 });
|
queue.EnqueueRange(new[] { 1, 2, 3 });
|
||||||
|
|
||||||
int output;
|
int output;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using NUnit.Framework;
|
using System.Text;
|
||||||
using System.Text;
|
|
||||||
using ICD.Common.Utils.Extensions;
|
using ICD.Common.Utils.Extensions;
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
namespace ICD.Common.Utils.Tests.Extensions
|
namespace ICD.Common.Utils.Tests.Extensions
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using ICD.Common.Utils.Extensions;
|
using System.Linq;
|
||||||
|
using ICD.Common.Utils.Extensions;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace ICD.Common.Utils.Tests.Extensions
|
namespace ICD.Common.Utils.Tests.Extensions
|
||||||
{
|
{
|
||||||
@@ -11,7 +11,7 @@ namespace ICD.Common.Utils.Tests.Extensions
|
|||||||
public void IndexOfTest()
|
public void IndexOfTest()
|
||||||
{
|
{
|
||||||
string first;
|
string first;
|
||||||
Assert.AreEqual(5, "test1test3test2".IndexOf(new string[] { "test2", "test3" }, out first));
|
Assert.AreEqual(5, "test1test3test2".IndexOf(new[] { "test2", "test3" }, out first));
|
||||||
Assert.AreEqual("test3", first);
|
Assert.AreEqual("test3", first);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ namespace ICD.Common.Utils.Tests.Extensions
|
|||||||
[Test]
|
[Test]
|
||||||
public void SplitStringDelimitersTest()
|
public void SplitStringDelimitersTest()
|
||||||
{
|
{
|
||||||
string[] split = "1234567890".Split(new string[] { "23", "67" }).ToArray();
|
string[] split = "1234567890".Split(new[] { "23", "67" }).ToArray();
|
||||||
|
|
||||||
Assert.AreEqual(3, split.Length);
|
Assert.AreEqual(3, split.Length);
|
||||||
Assert.AreEqual("145890", string.Join("", split));
|
Assert.AreEqual("145890", string.Join("", split));
|
||||||
@@ -78,7 +78,7 @@ namespace ICD.Common.Utils.Tests.Extensions
|
|||||||
[Test]
|
[Test]
|
||||||
public void RemoveCharactersTest()
|
public void RemoveCharactersTest()
|
||||||
{
|
{
|
||||||
Assert.AreEqual("13457890", "1234567890".Remove(new char[] { '2', '6' }));
|
Assert.AreEqual("13457890", "1234567890".Remove(new[] { '2', '6' }));
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestCase(true, "27652")]
|
[TestCase(true, "27652")]
|
||||||
|
|||||||
Reference in New Issue
Block a user