<commit_before>﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading;
using NUnit.Framework;
using SupTree.FileSystem;
using SupTree.Kafka;
using SupTree.MSMQ;
using SupTree.Test.TestImplementations;
using SupTree.ZeroMQ;

namespace SupTree.Test
{
    [TestFixture]
    internal class MessagingTests
    {
        [Test, TestCaseSource(typeof(MessagingTestDataFactory), nameof(MessagingTestDataFactory.TestCases))]
        public void CanSendAndReceiveMessage(IMessageSender messageQueueSender, IMessageReceiver messageQueueReceiver)
        {
            var message = GetNewMessage();

            messageQueueSender.Send(message);

            var receivedMessage = messageQueueReceiver.Receive();

            Assert.That(receivedMessage.Body, Is.EqualTo(message.Body));

            messageQueueSender.Dispose();
            messageQueueReceiver.Dispose();
        }

        [Test, TestCaseSource(typeof(MessagingTestDataFactory), nameof(MessagingTestDataFactory.TestCases))]
        public void CanSendAndReceiveMessages(IMessageSender messageQueueSender, IMessageReceiver messageQueueReceiver)
        {
            var message = GetNewMessage();

            messageQueueSender.Send(message);
            messageQueueSender.Send(message);
            messageQueueSender.Send(message);
            messageQueueSender.Send(message);
            messageQueueSender.Send(message);
            messageQueueSender.Send(message);

            var messages = new List<Message>();
            messages.Add(messageQueueReceiver.Receive());
            messages.Add(messageQueueReceiver.Receive());
            messages.Add(messageQueueReceiver.Receive());
            messages.Add(messageQueueReceiver.Receive());
            messages.Add(messageQueueReceiver.Receive());
            messages.Add(messageQueueReceiver.Receive()); // Kafka can't seem to get the last message
<commit_msg>Send 200 messages on test (from 6).<commit_after>﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading;
using NUnit.Framework;
using SupTree.FileSystem;
using SupTree.Kafka;
using SupTree.MSMQ;
using SupTree.Test.TestImplementations;
using SupTree.ZeroMQ;

namespace SupTree.Test
{
    [TestFixture]
    internal class MessagingTests
    {
        [Test, TestCaseSource(typeof(MessagingTestDataFactory), nameof(MessagingTestDataFactory.TestCases))]
        public void CanSendAndReceiveMessage(IMessageSender messageQueueSender, IMessageReceiver messageQueueReceiver)
        {
            var message = GetNewMessage();

            messageQueueSender.Send(message);

            var receivedMessage = messageQueueReceiver.Receive();

            Assert.That(receivedMessage.Body, Is.EqualTo(message.Body));

            messageQueueSender.Dispose();
            messageQueueReceiver.Dispose();
        }

        [Test, TestCaseSource(typeof(MessagingTestDataFactory), nameof(MessagingTestDataFactory.TestCases))]
        public void CanSendAndReceiveMessages(IMessageSender messageQueueSender, IMessageReceiver messageQueueReceiver)
        {
            var message = GetNewMessage();

            for (int i = 0; i < 200; i++)
            {
                messageQueueSender.Send(message); 
            }

            var messages = new List<Message>();
            for (int i = 0; i < 200; i++)
            {
                messages.Add(messageQueueReceiver.Receive()); 
            }

{'fraction_non_alphanumeric': 0.08857472590882862, 'fraction_numerical': 0.003462204270051933, 'mean_word_length': 3.050233644859813, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '1346528', 'n_tokens_mistral': 902, 'n_tokens_neox': 851, 'n_words': 166}