<commit_before>﻿using ApprovalTests.Namers;
using ApprovalTests.Reporters;
using Gigobyte.Mockaroo;
using Gigobyte.Mockaroo.Fields;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.IO;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace Tests.Mockaroo.IntegrationTest
{
    [TestClass]
    [DeploymentItem(Artifact.DataXLSX)]
    //[Ignore(/* Assign the "MockarooApiKey" variable with your Mockaroo API key to run these test. */)]
    public class CallsToMockarooServerTest
    {
        public static string MockarooApiKey = ApiKey.GetValue();

        public TestContext TestContext { get; set; }

        [ClassCleanup]
        public static void Cleanup()
        {
            ApprovalTests.Maintenance.ApprovalMaintenance.CleanUpAbandonedFiles();
        }

        /// <summary>
        /// Assert <see cref="MockarooClient.FetchDataAsync( Type,Schema, int)"/> can retrieve
        /// primitive data from mockaroo server.
        /// </summary>
        [TestMethod]
        [Owner(Dev.Ackara)]
        [DataSource(Data.ODBC, Data.ExcelConnectiongString, Data.BuiltInDataSheet, DataAccessMethod.Sequential)]
        public async Task FetchPrimitiveDataFromMockarooServer()
        {
            // Arrange
            int rows = 2, count = 0;
            var sut = new MockarooClient(MockarooApiKey);
            var dataType = Type.GetType($"System.{Convert.ToString(TestContext.DataRow[Data.TypeColumn])}");

            // Act
            var data = await sut.FetchDataAsync(dataType, rows);<commit_msg>ignore CallsToMockarooServerTest<commit_after>﻿using ApprovalTests.Namers;
using ApprovalTests.Reporters;
using Gigobyte.Mockaroo;
using Gigobyte.Mockaroo.Fields;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.IO;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace Tests.Mockaroo.IntegrationTest
{
    [TestClass]
    [DeploymentItem(Artifact.DataXLSX)]
    [Ignore(/* Assign the "MockarooApiKey" variable with your Mockaroo API key to run these test. */)]
    public class CallsToMockarooServerTest
    {
        public static string MockarooApiKey = ApiKey.GetValue();

        public TestContext TestContext { get; set; }

        [ClassCleanup]
        public static void Cleanup()
        {
            ApprovalTests.Maintenance.ApprovalMaintenance.CleanUpAbandonedFiles();
        }

        /// <summary>
        /// Assert <see cref="MockarooClient.FetchDataAsync( Type,Schema, int)"/> can retrieve
        /// primitive data from mockaroo server.
        /// </summary>
        [TestMethod]
        [Owner(Dev.Ackara)]
        [DataSource(Data.ODBC, Data.ExcelConnectiongString, Data.BuiltInDataSheet, DataAccessMethod.Sequential)]
        public async Task FetchPrimitiveDataFromMockarooServer()
        {
            // Arrange
            int rows = 2, count = 0;
            var sut = new MockarooClient(MockarooApiKey);
            var dataType = Type.GetType($"System.{Convert.ToString(TestContext.DataRow[Data.TypeColumn])}");

            // Act
            var data = await sut.FetchDataAsync(dataType, rows);
{'fraction_non_alphanumeric': 0.09882800126702566, 'fraction_numerical': 0.0012670256572695597, 'mean_word_length': 2.927860696517413, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '5629809', 'n_tokens_mistral': 924, 'n_tokens_neox': 901, 'n_words': 196}