<commit_before>﻿using System;
using System.Collections.Generic;
using System.IO;
using InEngine.Commands;
using InEngine.Core;
using InEngine.Core.Commands;
using InEngine.Core.Exceptions;
using InEngine.Core.Queuing;
using InEngine.Core.Queuing.Commands;              

namespace InEngine.IntegrationTest
{
    public class QueuingTest : AbstractCommand
    {
        public void Run()
        {
            var queue = QueueAdapter.Make();

            queue.ClearPendingQueue();
            queue.Publish(new Echo() { VerbatimText = "Core echo command." });
            new Length { }.Run();
            new Peek { PendingQueue = true }.Run();
            new Consume { Count = 10 }.Run();

            Enqueue.Command(() => Console.WriteLine("Core lambda command."))
                   .Dispatch();
            Enqueue.Command(() => new Echo { VerbatimText = "Core echo command in a lambda command." }.Run())
                   .Dispatch();
            Enqueue.Command(new AlwaysFail())
                   .WriteOutputTo("queueWriteTest-TheFileShouldNotExist.txt")
                   .WithRetries(4)
                   .Dispatch();

            var queueWriteIntegrationTest = "queueWriteIntegrationTest.txt";
            var queueAppendIntegrationTest = "queueAppendIntegrationTest.txt";
            File.Delete(queueWriteIntegrationTest);
            File.Delete(queueAppendIntegrationTest);
            Enqueue.Command(new Echo { VerbatimText = "Core echo command in a lambda command." })
                   .PingAfter("http://www.google.com")
                   .PingBefore("http://www.google.com")
                   .EmailOutputTo("<EMAIL>")
                   .WriteOutputTo(queueWriteIntegrationTest)
                   .AppendOutputTo(queueAppendIntegrationTest)
                   .Dispatch();
            Enqueue.Commands(new[] {
                new Echo { VerbatimText = "Chain Link 1" },
                new Echo { VerbatimText = "Chain Link 2" },
            }).Dispatch();

            Enqueue.Commands(new List<AbstractCommand> {
                new Echo { VerbatimText = "Chain Link A" },
                new AlwaysFail(),
                new Echo { VerbatimText = "Chain Link C" },
            });

            new Consume { Count = 1000 }.Run();
        }
    }
}<commit_msg>Add a few more test cases<commit_after>﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using InEngine.Commands;
using InEngine.Core;
using InEngine.Core.Commands;
using InEngine.Core.Exceptions;
using InEngine.Core.Queuing;
using InEngine.Core.Queuing.Commands;              

namespace InEngine.IntegrationTest
{
    public class QueuingTest : AbstractCommand
    {
        public override void Run()
        {
            var queue = QueueAdapter.Make();

            queue.ClearPendingQueue();
            queue.Publish(new Echo() { VerbatimText = "Core echo command." });
            new Length { }.Run();
            new Peek { PendingQueue = true }.Run();
            var consume = new Consume { Count = 1000 };

            Enqueue.Command(() => Console.WriteLine("Core lambda command."))
                   .Dispatch();
            Enqueue.Command(() => new Echo { VerbatimText = "Core echo command in a lambda command." }.Run())
                   .Dispatch();
            Enqueue.Command(new AlwaysFail())
                   .WriteOutputTo("queueWriteTest-TheFileShouldNotExist.txt")
                   .WithRetries(4)
                   .Dispatch();

            Enqueue.Commands(new[] {
                new Echo { VerbatimText = "Chain Link 1" },
                new Echo { VerbatimText = "Chain Link 2" },
            }).Dispatch();

            Enqueue.Commands(new List<AbstractCommand> {
                new Echo { VerbatimText = "Chain Link A" },
                new AlwaysFail(),
                new Echo { VerbatimText = "Chain Link C" },
            }).Dispatch();

            Enqueue.Commands(new List<AbstractCommand> {
                new Echo { VerbatimText = "Chain Link A" },
                new AlwaysFail(),
                new Echo { VerbatimText = "Chain Link C" },
            }).Dispatch();

            Enqueue.Commands(Enumerable.Range(0, 10).Select(x => new AlwaysSucceed() as AbstractCommand).ToList())
                   .Dispatch();
            
            consume.Run();

            var queueWriteIntegrationTest = "queueWriteIntegrationTest.txt";
            var queueAppendIntegrationTest = "queueAppendIntegrationTest.txt";
            File.Delete(queueWriteIntegrationTest);
            File.Delete(queueAppendIntegrationTest);
            Enqueue.Command(new Echo { VerbatimText = "Core echo command in a lambda command." })
                   .PingAfter("http://www.google.com")
                   .PingBefore("http://www.google.com")
                   .EmailOutputTo("<EMAIL>")
                   .WriteOutputTo(queueWriteIntegrationTest)
                   .AppendOutputTo(queueAppendIntegrationTest)
                   .Dispatch();

            consume.Run();
        }
    }
}
{'fraction_non_alphanumeric': 0.10920221169036334, 'fraction_numerical': 0.0037519747235387046, 'mean_word_length': 1.8280290340591847, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '3859896', 'n_tokens_mistral': 1337, 'n_tokens_neox': 1257, 'n_words': 295}