Files
pgsql-jellyfin/tests/Jellyfin.Extensions.Tests/CopyToExtensionsTests.cs
T
wjones e887356385 Improve XML docs and formatting in tests and constants
Added and enhanced XML documentation comments across the codebase, including detailed summaries and parameter descriptions for methods, classes, and constants. Documented all MatroskaConstants. Improved test readability with comments and explicit variable declarations. Made minor formatting and consistency fixes in test files. No functional changes. Updated project cache and binary files to reflect documentation improvements.
2026-02-21 15:46:18 -05:00

78 lines
3.2 KiB
C#

// <copyright file="CopyToExtensionsTests.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace Jellyfin.Extensions.Tests
{
using System;
using System.Collections.Generic;
using Xunit;
/// <summary>
/// Tests for CopyTo extension methods.
/// </summary>
public static class CopyToExtensionsTests
{
/// <summary>
/// Gets test data for valid CopyTo operations.
/// </summary>
/// <returns>The test data.</returns>
public static TheoryData<IReadOnlyList<int>, IList<int>, int, IList<int>> CopyTo_Valid_Correct_TestData()
{
TheoryData<IReadOnlyList<int>, IList<int>, int, IList<int>> 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;
}
/// <summary>
/// Tests that CopyTo correctly copies elements.
/// </summary>
/// <param name="source">The source list.</param>
/// <param name="destination">The destination list.</param>
/// <param name="index">The starting index.</param>
/// <param name="expected">The expected result.</param>
[Theory]
[MemberData(nameof(CopyTo_Valid_Correct_TestData))]
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);
}
/// <summary>
/// Gets test data for invalid CopyTo operations that should throw.
/// </summary>
/// <returns>The test data.</returns>
public static TheoryData<IReadOnlyList<int>, IList<int>, int> CopyTo_Invalid_ThrowsArgumentOutOfRangeException_TestData()
{
TheoryData<IReadOnlyList<int>, IList<int>, int> 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;
}
/// <summary>
/// Tests that CopyTo throws ArgumentOutOfRangeException for invalid inputs.
/// </summary>
/// <param name="source">The source list.</param>
/// <param name="destination">The destination list.</param>
/// <param name="index">The starting index.</param>
[Theory]
[MemberData(nameof(CopyTo_Invalid_ThrowsArgumentOutOfRangeException_TestData))]
public static void CopyTo_Invalid_ThrowsArgumentOutOfRangeException(IReadOnlyList<int> source, IList<int> destination, int index)
{
Assert.Throws<ArgumentOutOfRangeException>(() => source.CopyTo(destination, index));
}
}
}