<commit_before>namespace MassTransit.ServiceBus.Tests.HealthMonitoring
{
    using System;
    using System.Threading;
    using Internal;
    using MassTransit.ServiceBus.HealthMonitoring;
    using MassTransit.ServiceBus.HealthMonitoring.Messages;
    using NUnit.Framework;
    using Rhino.Mocks;

    [TestFixture]
    public class When_a_suspect_is_received :
        Specification
    {
        [Test]
        public void An_Investigation_should_happen()
        {
            IServiceBus bus = DynamicMock<IServiceBus>();
            IEndpointResolver er = DynamicMock<IEndpointResolver>();
            IEndpoint ep = DynamicMock<IEndpoint>();
            Investigator inv = new Investigator(bus, er);

            using (Record())
            {
                Expect.Call(er.Resolve(new Uri("msmq://localhost/test"))).Return(ep);
                Expect.Call(delegate
                                {
                                    ep.Send(new Ping(inv.CorrelationId), new TimeSpan(0,3,0));
                                });
            }
            using(Playback())
            {
                inv.Consume(new Suspect(new Uri("msmq://localhost/test")));
            }
        }

        [Test]
        public void When_a_ping_times_out()
        {
            IServiceBus bus = DynamicMock<IServiceBus>();
            IEndpointResolver er = DynamicMock<IEndpointResolver>();
            IEndpoint ep = DynamicMock<IEndpoint>();
            Investigator inv = new Investigator(bus, er, 50);
            Uri u = new Uri("msmq://localhost/test");
                ManualResetEvent evt = new ManualResetEvent(false);

            using (Record())
            {
                Expect.Call(er.Resolve(u)).Return(ep);
                Expect.Call(delegate
                                {
                                    ep.Send(new Ping(inv.CorrelationId), new TimeSpan(0, 3, 0));
                                });
                Expect.Call(delegate { bus.Publish(new DownEndpoint(u)); }).Do(new Publish(delegate {evt.Set();}));
            }
            using (Playback())
            {
                inv.Consume(new Suspect(new Uri("msmq://localhost/test")));
                evt.WaitOne(500, true);
            }
        }

        private delegate void Publish(DownEndpoint epp);
    }
}<commit_msg>even closer<commit_after>namespace MassTransit.ServiceBus.Tests.HealthMonitoring
{
    using System;
    using System.Threading;
    using Internal;
    using MassTransit.ServiceBus.HealthMonitoring;
    using MassTransit.ServiceBus.HealthMonitoring.Messages;
    using NUnit.Framework;
    using Rhino.Mocks;

    [TestFixture]
    public class When_a_suspect_is_received :
        Specification
    {
        [Test]
        public void An_Investigation_should_happen()
        {
            IServiceBus bus = DynamicMock<IServiceBus>();
            IEndpointResolver er = DynamicMock<IEndpointResolver>();
            IEndpoint ep = DynamicMock<IEndpoint>();
            Investigator inv = new Investigator(bus, er);

            using (Record())
            {
                Expect.Call(er.Resolve(new Uri("msmq://localhost/test"))).Return(ep);
                Expect.Call(delegate
                                {
                                    ep.Send(new Ping(inv.CorrelationId), new TimeSpan(0,3,0));
                                });
            }
            using(Playback())
            {
                inv.Consume(new Suspect(new Uri("msmq://localhost/test")));
            }
        }

        [Test]
        public void When_a_ping_times_out()
        {
            IServiceBus bus = DynamicMock<IServiceBus>();
            IEndpointResolver er = DynamicMock<IEndpointResolver>();
            IEndpoint ep = DynamicMock<IEndpoint>();
            Investigator inv = new Investigator(bus, er, 50);
            Uri u = new Uri("msmq://localhost/test");
                ManualResetEvent evt = new ManualResetEvent(false);

            using (Record())
            {
                Expect.Call(er.Resolve(u)).Return(ep);
                Expect.Call(delegate
                                {
                                    ep.Send(new Ping(inv.CorrelationId), new TimeSpan(0, 3, 0));
                                });
                Expect.Call(delegate { bus.Publish(new DownEndpoint(u)); }).Do(new Publish(delegate {evt.Set();})).IgnoreArguments();
            }
            using (Playback())
            {
                inv.Consume(new Suspect(new Uri("msmq://localhost/test")));
                Assert.IsTrue(evt.WaitOne(500, true));
            }
        }

        private delegate void Publish(DownEndpoint epp);
    }
}
{'fraction_non_alphanumeric': 0.10710475784083635, 'fraction_numerical': 0.004693834008960956, 'mean_word_length': 1.5843439911797133, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '141600', 'n_tokens_mistral': 1260, 'n_tokens_neox': 1196, 'n_words': 215}