<commit_before>﻿namespace RedisSessionProviderUnitTests.RedisSessionStateItemCollectionTests
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    using NUnit.Framework;
    using Moq;
    using RedisSessionProvider;
    using RedisSessionProvider.Serialization;
    
    [TestFixture]
    public class SingleThreadedTests
    {
        private RedisSessionStateItemCollection items;

        private RedisJSONSerializer srsly;
        
        [SetUp]
        public void OnBeforeTestExecute()
        {
            srsly = new RedisJSONSerializer();

            this.items = new RedisSessionStateItemCollection(
                new Dictionary<string, byte[]> { 
                    { "a", Encoding.UTF8.GetBytes(srsly.SerializeOne("a", "x")) },
                    { "b", Encoding.UTF8.GetBytes(srsly.SerializeOne("b", "y")) },
                    { "c", Encoding.UTF8.GetBytes(srsly.SerializeOne("c", "z")) }
                },
                "fakeCollection");
        }

        [Test]
        public void RedisItemsCollectionConstructorTest()
        {
            Assert.AreEqual("x", (string)this.items["a"]);
            Assert.AreEqual("y", (string)this.items["b"]);
            Assert.AreEqual("z", (string)this.items["c"]);
        }

        [Test]
        public void RedisItemsCollectionAddTest()
        {
            this.items["something"] = "a thing";
            this.items["foo"] = "bar";
            this.items["lucas"] = "uses venmo";

            Assert.AreEqual("a thing", this.items["something"]);
            Assert.AreEqual("bar", this.items["foo"]);
            Assert.AreEqual("uses venmo", this.items["lucas"]);

            Assert.Throws<NotImplementedException>(<commit_msg>Added case insensitive access test<commit_after>﻿namespace RedisSessionProviderUnitTests.RedisSessionStateItemCollectionTests
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    using NUnit.Framework;
    using Moq;
    using RedisSessionProvider;
    using RedisSessionProvider.Serialization;
    
    [TestFixture]
    public class SingleThreadedTests
    {
        private RedisSessionStateItemCollection items;

        private RedisJSONSerializer srsly;
        
        [SetUp]
        public void OnBeforeTestExecute()
        {
            srsly = new RedisJSONSerializer();

            this.items = new RedisSessionStateItemCollection(
                new Dictionary<string, byte[]> { 
                    { "a", Encoding.UTF8.GetBytes(srsly.SerializeOne("a", "x")) },
                    { "b", Encoding.UTF8.GetBytes(srsly.SerializeOne("b", "y")) },
                    { "c", Encoding.UTF8.GetBytes(srsly.SerializeOne("c", "z")) }
                },
                "fakeCollection");
        }

        [Test]
        public void RedisItemsCollectionConstructorTest()
        {
            Assert.AreEqual("x", (string)this.items["a"]);
            Assert.AreEqual("y", (string)this.items["b"]);
            Assert.AreEqual("z", (string)this.items["c"]);
        }


        [Test]
        public void RedisItemsCollectionCaseInsensitiveAccessTest()
        {
            Assert.AreEqual("x", (string)this.items["A"]);
            Assert.AreEqual("y", (string)this.items["B"]);
            Assert.AreEqual("z", (string)this.items["C"]);
        }


        [Test]
        public void RedisItemsCollectionAddTest()
        {
            this.items["something"] = "a thing";
            this.items["foo"] = "bar";
            this.items["lucas"] = "uses venmo";

            Assert.AreEqual("a thing", this.items["something"]);
            Assert.AreEqual("bar", this.items["foo"]);
            Assert.AreEqual("uses venmo", this.items["lucas"]);

            Assert.Throws<NotImplementedException>(
{'fraction_non_alphanumeric': 0.1282051282051282, 'fraction_numerical': 0.0015384615384615385, 'mean_word_length': 2.1923076923076925, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '2658279', 'n_tokens_mistral': 1107, 'n_tokens_neox': 1082, 'n_words': 181}