public void SendMessageStats_sends_message_timing()
        {
            Given_the_tab_with_mock_statsdpipe();
            And_message_with("MethodOneName", 5);

            StatsTab.SendMessageStats(MockMessage.Object, MockTabSetupContext.Object);

            MockStatsdPipe.Verify(s => s.Timing("MethodOneName_subtext", 5, 1));
        }
        public void SendMessageStats_sends_stats_timing_to_statsd()
        {
            Given_the_tab_with_mock_statsdpipe();
            And_message_with("MethodOneName", 5);

            StatsTab.SendMessageStats(MockMessage.Object, MockTabSetupContext.Object);

            MockStatsdPipe.Verify(pipe => pipe.Timing("GlimpseStatsdNetTiming", It.IsAny <long>(), 1));
        }
        public void SendMessageStatus_cleans_periods_from_key_when_using_EventName()
        {
            Given_the_tab_with_mock_statsdpipe();
            And_message_with("Method.One.Name", 5);

            StatsTab.SendMessageStats(MockMessage.Object, MockTabSetupContext.Object);

            MockStatsdPipe.Verify(s => s.Timing("Method-One-Name_subtext", 5, 1));
        }
        public void SendMessageStatus_does_not_use_subtext_if_empty()
        {
            Given_the_tab_with_mock_statsdpipe();
            And_message_with("MethodOneName", 5);
            MockMessage.Object.EventSubText = String.Empty;

            StatsTab.SendMessageStats(MockMessage.Object, MockTabSetupContext.Object);

            MockStatsdPipe.Verify(s => s.Timing("MethodOneName", 5, 1));
        }
        public void SendMessageStats_ignores_stats_timing_messages()
        {
            Given_the_tab_with_mock_statsdpipe();
            var message = new StatsdNetMessage();

            StatsTab.SendMessageStats(message, MockTabSetupContext.Object);

            MockStatsdPipe.Verify(pipe => pipe.Timing(It.IsAny <string>(), It.IsAny <long>(), 1), Times.Never());
            MockTabSetupContext.Verify(ctx => ctx.GetTabStore(), Times.Never());
            MockMessageBroker.Verify(broker => broker.Publish(It.IsAny <StatsdNetMessage>()), Times.Never);
        }
        public void SendMessageStatus_uses_MethodInfo_when_message_is_SourceMessage()
        {
            Given_the_tab_with_mock_statsdpipe();
            And_SourceMessage();

            StatsTab.SendMessageStats(MockSourceMessage.Object as ITimelineMessage, MockTabSetupContext.Object);

            string name = "Tests.ExecutionStatsTests.Given_the_tab_with_mock_statsdpipe";

            MockStatsdPipe.Verify(s => s.Timing(name, 5, 1));
        }