<commit_before>using System.Collections.Generic;
using FluentAssertions;
using Light.DependencyInjection.DataStructures;
using Xunit;

namespace Light.DependencyInjection.Tests.DataStructuresTests
{
    [Trait("Category", "Functional Tests")]
    public class ReaderWriterLockedListTests
    {
        [Theory]
        [InlineData(new[] { 1, 2, 3 }, 4)]
        [InlineData(new[] { "Foo", "Bar" }, "Baz")]
        [InlineData(new string[] { }, "Foo")]
        public void Add<T>(T[] existingItems, T itemToAdd)
        {
            // ReSharper disable once UseObjectOrCollectionInitializer
            var testTarget = new ReaderWriterLockedList<T>(existingItems);

            testTarget.Add(itemToAdd);

            var expected = new List<T>(existingItems) { itemToAdd };
            testTarget.Should().Equal(expected);
        }

        [Fact]
        public void InitialCapacity()
        {
            var testTarget = new ReaderWriterLockedList<object>();

            testTarget.Capacity.Should().Be(ReaderWriterLockedList<object>.DefaultCapacity);
        }

        [Theory]
        [InlineData(new[] { 1, 2, 3, 4, 5 }, 0, 10, new[] { 10, 1, 2, 3, 4, 5 })]
        [InlineData(new[] { "Foo", "Bar", "Baz" }, 1, "Qux", new[] { "Foo", "Qux", "Bar", "Baz" })]
        [InlineData(new[] { "Foo", "Bar" }, "2", "Baz", new[] { "Foo", "Bar", "Baz" })]
        [InlineData(new int[] { }, 0, 42, new[] { 42 })]
        public void Insert<T>(T[] existingItems, int index, T item, T[] expected)
        {
            var testTarget = new ReaderWriterLockedList<T>(existingItems);

            testTarget.Insert(index, item);

            testTarget.Should().Equal(expected);
        }
    }
}<commit_msg>added indexer test for ReaderWriterLockedList<commit_after>using System.Collections.Generic;
using FluentAssertions;
using Light.DependencyInjection.DataStructures;
using Xunit;

namespace Light.DependencyInjection.Tests.DataStructuresTests
{
    [Trait("Category", "Functional Tests")]
    public sealed class ReaderWriterLockedListTests
    {
        [Theory]
        [InlineData(new[] { 1, 2, 3 }, 4)]
        [InlineData(new[] { "Foo", "Bar" }, "Baz")]
        [InlineData(new string[] { }, "Foo")]
        public void Add<T>(T[] existingItems, T itemToAdd)
        {
            // ReSharper disable once UseObjectOrCollectionInitializer
            var testTarget = new ReaderWriterLockedList<T>(existingItems);

            testTarget.Add(itemToAdd);

            var expected = new List<T>(existingItems) { itemToAdd };
            testTarget.Should().Equal(expected);
        }

        [Fact]
        public void InitialCapacity()
        {
            var testTarget = new ReaderWriterLockedList<object>();

            testTarget.Capacity.Should().Be(ReaderWriterLockedList<object>.DefaultCapacity);
        }

        [Theory]
        [InlineData(new[] { 1, 2, 3, 4, 5 }, 0, 10, new[] { 10, 1, 2, 3, 4, 5 })]
        [InlineData(new[] { "Foo", "Bar", "Baz" }, 1, "Qux", new[] { "Foo", "Qux", "Bar", "Baz" })]
        [InlineData(new[] { "Foo", "Bar" }, "2", "Baz", new[] { "Foo", "Bar", "Baz" })]
        [InlineData(new int[] { }, 0, 42, new[] { 42 })]
        public void Insert<T>(T[] existingItems, int index, T item, T[] expected)
        {
            var testTarget = new ReaderWriterLockedList<T>(existingItems);

            testTarget.Insert(index, item);

            testTarget.Should().Equal(expected);
        }

        [Theory]
        [InlineData(new[] { 1, 2, 3 }, 2, 42, new[] { 1, 2, 42 })]
        [InlineData(new[] { "Foo", "Bar" }, 0, "Baz", new[] { "Baz", "Bar" })]
        public void Overwrite<T>(T[] existingItems, int index, T item, T[] expected)
        {
            // ReSharper disable once UseObjectOrCollectionInitializer
            var testTarget = new ReaderWriterLockedList<T>(existingItems);

            testTarget[index] = item;

            testTarget.Should().Equal(expected);
        }
    }
}
{'fraction_non_alphanumeric': 0.15466262319939347, 'fraction_numerical': 0.01592115238817286, 'mean_word_length': 2.585144927536232, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '21628', 'n_tokens_mistral': 1281, 'n_tokens_neox': 1206, 'n_words': 281}