aboutsummaryrefslogtreecommitdiff
path: root/tests/Jellyfin.Extensions.Tests/CopyToExtensionsTests.cs
diff options
context:
space:
mode:
authorBond_009 <bond.009@outlook.com>2023-12-18 22:02:31 +0100
committerBond_009 <bond.009@outlook.com>2023-12-18 22:02:31 +0100
commit7bf831da62f00b7df2e847d6298012b17997285f (patch)
treeecbbe98ffd91a684a32eab2919e7e4da94a4c531 /tests/Jellyfin.Extensions.Tests/CopyToExtensionsTests.cs
parent12df192a31cc0e737d58d4cf517784249bfd9d0b (diff)
Fix tests
Diffstat (limited to 'tests/Jellyfin.Extensions.Tests/CopyToExtensionsTests.cs')
-rw-r--r--tests/Jellyfin.Extensions.Tests/CopyToExtensionsTests.cs40
1 files changed, 15 insertions, 25 deletions
diff --git a/tests/Jellyfin.Extensions.Tests/CopyToExtensionsTests.cs b/tests/Jellyfin.Extensions.Tests/CopyToExtensionsTests.cs
index d46beedd9..95f9a5fcf 100644
--- a/tests/Jellyfin.Extensions.Tests/CopyToExtensionsTests.cs
+++ b/tests/Jellyfin.Extensions.Tests/CopyToExtensionsTests.cs
@@ -8,20 +8,18 @@ namespace Jellyfin.Extensions.Tests
{
public static TheoryData<IReadOnlyList<int>, IList<int>, int, IList<int>> CopyTo_Valid_Correct_TestData()
{
- var data = new TheoryData<IReadOnlyList<int>, IList<int>, int, IList<int>>();
-
- data.Add(
- new[] { 0, 1, 2, 3, 4, 5 }, new[] { 0, 0, 0, 0, 0, 0 }, 0, new[] { 0, 1, 2, 3, 4, 5 });
-
- data.Add(
- new[] { 0, 1, 2 }, new[] { 5, 4, 3, 2, 1, 0 }, 2, new[] { 5, 4, 0, 1, 2, 0 } );
+ var data = new TheoryData<IReadOnlyList<int>, IList<int>, int, IList<int>>
+ {
+ { new[] { 0, 1, 2, 3, 4, 5 }, new[] { 0, 0, 0, 0, 0, 0 }, 0, new[] { 0, 1, 2, 3, 4, 5 } },
+ { new[] { 0, 1, 2 }, new[] { 5, 4, 3, 2, 1, 0 }, 2, new[] { 5, 4, 0, 1, 2, 0 } }
+ };
return data;
}
[Theory]
[MemberData(nameof(CopyTo_Valid_Correct_TestData))]
- public static void CopyTo_Valid_Correct<T>(IReadOnlyList<T> source, IList<T> destination, int index, IList<T> expected)
+ public static void CopyTo_Valid_Correct(IReadOnlyList<int> source, IList<int> destination, int index, IList<int> expected)
{
source.CopyTo(destination, index);
Assert.Equal(expected, destination);
@@ -29,29 +27,21 @@ namespace Jellyfin.Extensions.Tests
public static TheoryData<IReadOnlyList<int>, IList<int>, int> CopyTo_Invalid_ThrowsArgumentOutOfRangeException_TestData()
{
- var data = new TheoryData<IReadOnlyList<int>, IList<int>, int>();
-
- data.Add(
- new[] { 0, 1, 2, 3, 4, 5 }, new[] { 0, 0, 0, 0, 0, 0 }, -1 );
-
- data.Add(
- new[] { 0, 1, 2 }, new[] { 5, 4, 3, 2, 1, 0 }, 6 );
-
- data.Add(
- new[] { 0, 1, 2 }, Array.Empty<int>(), 0 );
-
- data.Add(
- new[] { 0, 1, 2, 3, 4, 5 }, new[] { 0 }, 0 );
-
- data.Add(
- new[] { 0, 1, 2, 3, 4, 5 }, new[] { 0, 0, 0, 0, 0, 0 }, 1 );
+ var data = new TheoryData<IReadOnlyList<int>, IList<int>, int>
+ {
+ { new[] { 0, 1, 2, 3, 4, 5 }, new[] { 0, 0, 0, 0, 0, 0 }, -1 },
+ { new[] { 0, 1, 2 }, new[] { 5, 4, 3, 2, 1, 0 }, 6 },
+ { new[] { 0, 1, 2 }, Array.Empty<int>(), 0 },
+ { new[] { 0, 1, 2, 3, 4, 5 }, new[] { 0 }, 0 },
+ { new[] { 0, 1, 2, 3, 4, 5 }, new[] { 0, 0, 0, 0, 0, 0 }, 1 }
+ };
return data;
}
[Theory]
[MemberData(nameof(CopyTo_Invalid_ThrowsArgumentOutOfRangeException_TestData))]
- public static void CopyTo_Invalid_ThrowsArgumentOutOfRangeException<T>(IReadOnlyList<T> source, IList<T> destination, int index)
+ public static void CopyTo_Invalid_ThrowsArgumentOutOfRangeException(IReadOnlyList<int> source, IList<int> destination, int index)
{
Assert.Throws<ArgumentOutOfRangeException>(() => source.CopyTo(destination, index));
}