<commit_before>﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http.SelfHost;

namespace WebRequestReflector.Tests
{
	[TestClass]
	public class SelfHostTests
	{
		[TestMethod]
		public async Task SelfHostTest()
		{
			HttpSelfHostConfiguration config = new HttpSelfHostConfiguration("http://localhost:9967/");
			config.HostNameComparisonMode = HostNameComparisonMode.Exact;
			WebRequestReflectorSelfHost wrrsh = new WebRequestReflectorSelfHost(config);

			Assert.IsNotNull(wrrsh);

			await wrrsh.StartAsync();
			await wrrsh.StopAsync();
		}
	}
}
<commit_msg>Added SelfHostPingTest<commit_after>﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.ServiceModel;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http.SelfHost;

namespace WebRequestReflector.Tests
{
	[TestClass]
	public class SelfHostTests
	{
		public const string HostUrl = "http://localhost:9967/";

		[TestMethod]
		public async Task SelfHostTest()
		{
			HttpSelfHostConfiguration config = new HttpSelfHostConfiguration(HostUrl);
			config.HostNameComparisonMode = HostNameComparisonMode.Exact;
			WebRequestReflectorSelfHost wrrsh = new WebRequestReflectorSelfHost(config);

			Assert.IsNotNull(wrrsh);

			await wrrsh.StartAsync();
			await wrrsh.StopAsync();
		}
		
		[TestMethod]
		public async Task SelfHostPingTest()
		{
			HttpSelfHostConfiguration config = new HttpSelfHostConfiguration(HostUrl);
			config.HostNameComparisonMode = HostNameComparisonMode.Exact;
			WebRequestReflectorSelfHost wrrsh = new WebRequestReflectorSelfHost(config);

			Assert.IsNotNull(wrrsh);

			await wrrsh.StartAsync();

			using(HttpClient client = new HttpClient())
			{
				client.DefaultRequestHeaders.Accept.Clear();
				client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/xml"));
				var response = await client.PostAsync(HostUrl + "create", new StringContent(""));
				Assert.IsNotNull(response);
				Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
				Assert.IsNotNull(response.Content);
				Assert.AreEqual("application/xml", response.Content.Headers.ContentType.MediaType);
			}

			await wrrsh.StopAsync();
		}
	}
}

{'fraction_non_alphanumeric': 0.09878542510121457, 'fraction_numerical': 0.0032388663967611335, 'mean_word_length': 5.502631578947368, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '5819501', 'n_tokens_mistral': 816, 'n_tokens_neox': 740, 'n_words': 136}