<commit_before>﻿using System;
using System.Threading;
using System.Windows.Forms;
using Glyssen.Utilities;
using NUnit.Framework;
using Paratext;
using SIL.Windows.Forms.Scripture;

namespace GlyssenTests.Utilities
{
	class VerseRefExtensionsTests
	{
		[Test]
		public void SendScrReference()
		{
			DummyForm.Start();

			// MAT 28:18
			VerseRef vr = new VerseRef(040028018);
			vr.SendScrReference();

			Thread.Sleep(2000);

			Assert.AreEqual(vr, DummyForm.MessageReceived);

			DummyForm.Stop();
		}

		private class DummyForm : Form
		{
			public static VerseRef MessageReceived;
			private static DummyForm mInstance;

			public static void Start()
			{
				Thread t = new Thread(RunForm);
				t.SetApartmentState(ApartmentState.STA);
				t.IsBackground = true;
				t.Start();
			}
			public static void Stop()
			{
				if (mInstance == null) 
					throw new InvalidOperationException("Stop without Start");
				mInstance.Invoke(new MethodInvoker(mInstance.EndForm));
			}
			private static void RunForm()
			{
				Application.Run(new DummyForm());
			}<commit_msg>Make VerseRefExtensionsTests.SendScrReference "By Hand Only"<commit_after>﻿using System;
using System.Threading;
using System.Windows.Forms;
using Glyssen.Utilities;
using NUnit.Framework;
using Paratext;
using SIL.Windows.Forms.Scripture;

namespace GlyssenTests.Utilities
{
	class VerseRefExtensionsTests
	{
		[Test, Ignore("By Hand Only")]
		public void SendScrReference()
		{
			DummyForm.Start();

			// MAT 28:18
			VerseRef vr = new VerseRef(040028018);
			vr.SendScrReference();

			Thread.Sleep(1000);

			Assert.AreEqual(vr, DummyForm.MessageReceived);

			DummyForm.Stop();
		}

		private class DummyForm : Form
		{
			public static VerseRef MessageReceived;
			private static DummyForm mInstance;

			public static void Start()
			{
				Thread t = new Thread(RunForm);
				t.SetApartmentState(ApartmentState.STA);
				t.IsBackground = true;
				t.Start();
			}
			public static void Stop()
			{
				if (mInstance == null) 
					throw new InvalidOperationException("Stop without Start");
				mInstance.Invoke(new MethodInvoker(mInstance.EndForm));
			}
			private static void RunForm()
			{
				Application.Run(new DummyForm());
			}
{'fraction_non_alphanumeric': 0.10374379792512405, 'fraction_numerical': 0.015336039693279206, 'mean_word_length': 3.7904967602591793, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1209324', 'n_tokens_mistral': 881, 'n_tokens_neox': 703, 'n_words': 163}