<commit_before>﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Reactive.Threading.Tasks;
using System.Text;
using System.Threading.Tasks;
using Taut.RealTime;

namespace Taut.Test.RealTime
{
    public class RealTimeMessagingServiceTests : ApiServiceTestBase
    {
        private static RealTimeMessagingStartResponse OkRealTimeMessagingStartResponse;

        [ClassInitialize]
        public static void ClassInitialize(TestContext context)
        {
            OkRealTimeMessagingStartResponse = JsonLoader.LoadJson<RealTimeMessagingStartResponse>(@"RealTime/Data/rtm_start.json");
        }

        #region Start

        [TestMethod]
        public async Task WhenStartIsCalled_ThenRtmStartIsIncludedInRequest()
        {
            await ShouldHaveCalledTestHelperAsync(OkRealTimeMessagingStartResponse,
                async service => await service.Start().ToTask(),
                "*rtm.start");
        }

        #endregion

        #region Helpers

        private async Task ShouldHaveCalledTestHelperAsync<T>(T response, Func<IRealTimeMessagingService, Task<T>> action,
            string shouldHaveCalled)
        {
            // Arrange<commit_msg>Make sure the RealTimeMessagingService test actually runs.<commit_after>﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Reactive.Threading.Tasks;
using System.Text;
using System.Threading.Tasks;
using Taut.RealTime;

namespace Taut.Test.RealTime
{
    [TestClass]
    public class RealTimeMessagingServiceTests : ApiServiceTestBase
    {
        private static RealTimeMessagingStartResponse OkRealTimeMessagingStartResponse;

        [ClassInitialize]
        public static void ClassInitialize(TestContext context)
        {
            OkRealTimeMessagingStartResponse = JsonLoader.LoadJson<RealTimeMessagingStartResponse>(@"RealTime/Data/rtm_start.json");
        }

        #region Start

        [TestMethod]
        public async Task WhenStartIsCalled_ThenRtmStartIsIncludedInRequest()
        {
            await ShouldHaveCalledTestHelperAsync(OkRealTimeMessagingStartResponse,
                async service => await service.Start().ToTask(),
                "*rtm.start");
        }

        #endregion

        #region Helpers

        private async Task ShouldHaveCalledTestHelperAsync<T>(T response, Func<IRealTimeMessagingService, Task<T>> action,
            string shouldHaveCalled)
        {
            // Arrange
{'fraction_non_alphanumeric': 0.07222009935040122, 'fraction_numerical': 0.0, 'mean_word_length': 3.175438596491228, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, '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': '2761989', 'n_tokens_mistral': 696, 'n_tokens_neox': 686, 'n_words': 134}