<commit_before>﻿using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using DDev.Tools;
using FluentAssertions;

namespace DDev.Tools.Test
{
    [TestFixture]
    [Author("<NAME>")]
    public class LinqUtilsTest
    {
        /// <summary>
        /// Tests the clustering
        /// </summary>
        /// <param name="key"></param>
        /// <param name="values"></param>
        [TestCase(1, new string[] { "astapor", "mereen", "bravos" })]
        [TestCase(6, new string[] { "kings landing", "winterfell" })]
        public void ToClusteredDictionary_ShouldCreateSubset_WhenKeyMatches(int key, string[] values)
        {
            List<TestObject<int, string>> testObjects = new List<TestObject<int, string>>(values.Length);

            foreach (string v in values)
                testObjects.Add(new TestObject<int, string>(key, v));

            testObjects.ToClusteredDictionary(v => v.Key)
                .Keys
                .Should()
                .HaveCount(1);

            testObjects.ToClusteredDictionary(v => v.Key)
                .First()
                .Value
                .Should()
                .HaveCount(2);

            testObjects.ToClusteredDictionary(v => v.Key)
                .First()
                .Value
                .Should()<commit_msg>Fixed tests<commit_after>﻿using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using DDev.Tools;
using FluentAssertions;

namespace DDev.Tools.Test
{
    [TestFixture]
    [Author("<NAME>")]
    public class LinqUtilsTest
    {
        /// <summary>
        /// Tests the clustering
        /// </summary>
        /// <param name="key"></param>
        /// <param name="values"></param>
        [TestCase(1, new string[] { "astapor", "meereen", "braavos" })]
        [TestCase(6, new string[] { "kings landing", "winterfell", "pentos" })]
        public void ToClusteredDictionary_ShouldCreateSubset_WhenKeyMatches(int key, string[] values)
        {
            List<TestObject<int, string>> testObjects = new List<TestObject<int, string>>(values.Length);

            foreach (string v in values)
                testObjects.Add(new TestObject<int, string>(key, v));

            testObjects.ToClusteredDictionary(v => v.Key)
                .Keys
                .Should()
                .HaveCount(1);

            testObjects.ToClusteredDictionary(v => v.Key)
                .First()
                .Value
                .Should()
                .HaveCount(values.Count());

            testObjects.ToClusteredDictionary(v => v.Key)
                .First()
                .Value
                .Select(t => t.Value)
                .Should()
{'fraction_non_alphanumeric': 0.130450194966324, 'fraction_numerical': 0.0024813895781637717, 'mean_word_length': 1.912280701754386, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 34, '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': '7573644', 'n_tokens_mistral': 816, 'n_tokens_neox': 783, 'n_words': 165}