<commit_before>﻿using System;
using System.Collections.Generic;
using System.Xml;
using NUnit.Framework;
using Palaso.Reporting;
using Palaso.TestUtilities;
using SIL.Archiving.IMDI;

namespace SIL.Archiving.Tests
{
	[TestFixture]
	[Category("Archiving")]
	class IMDIArchivingDlgViewModelTests
	{
		private IMDIArchivingDlgViewModel _model;
		private TemporaryFolder _tmpFolder;
		private const string kAppName = "Tèst App Náme";
		private const string kTitle = "Tèst Title";
		private const string kArchiveId = "Tèst Corpus Náme";  // include some invalid characters for testing
		private Dictionary<string, Tuple<IEnumerable<string>, string>> _filesToAdd;

		#region Setup and Teardown
		/// ------------------------------------------------------------------------------------
		[SetUp]
		public void Setup()
		{
			ErrorReport.IsOkToInteractWithUser = false;
			_tmpFolder = new TemporaryFolder("IMDIArchiveHelperTestFolder");
			_model = new IMDIArchivingDlgViewModel(kAppName, kTitle, kArchiveId, null, true,
				SetFilesToArchive, _tmpFolder.Path);
		}

		/// ------------------------------------------------------------------------------------
		[TearDown]
		public void TearDown()
		{
			_model.CleanUp();
			_tmpFolder.Dispose();
		}
		#endregion

		#region Miscellaneous Tests
		/// ------------------------------------------------------------------------------------
		[Test]
		public void NormalizeFilename_FileName_NormalizedFileName()
		{
			const string fileName = "My# \nFile %\t Name&^%.mp3";
			var normalized = _model.NormalizeFilename("", fileName);
			Assert.AreEqual("My+File+Name_.mp3", normalized);
		}

		/// ------------------------------------------------------------------------------------
		[Test]
		public void CorpusDirectoryName_ValidNameForNewDirectory()
		{
			var dirName = _model.CorpusDirectoryName;
			Assert.AreEqual("T_st_Corpus_N_me", dirName);
		}
		#endregion<commit_msg>Fix broken test.<commit_after>﻿using System;
using System.Collections.Generic;
using System.Xml;
using NUnit.Framework;
using Palaso.Reporting;
using Palaso.TestUtilities;
using SIL.Archiving.IMDI;

namespace SIL.Archiving.Tests
{
	[TestFixture]
	[Category("Archiving")]
	class IMDIArchivingDlgViewModelTests
	{
		private IMDIArchivingDlgViewModel _model;
		private TemporaryFolder _tmpFolder;
		private const string kAppName = "Tèst App Náme";
		private const string kTitle = "Tèst Title";
		private const string kArchiveId = "Tèst Corpus Náme";  // include some invalid characters for testing
		private Dictionary<string, Tuple<IEnumerable<string>, string>> _filesToAdd;

		#region Setup and Teardown
		/// ------------------------------------------------------------------------------------
		[SetUp]
		public void Setup()
		{
			ErrorReport.IsOkToInteractWithUser = false;
			_tmpFolder = new TemporaryFolder("IMDIArchiveHelperTestFolder");
			_model = new IMDIArchivingDlgViewModel(kAppName, kTitle, kArchiveId, null, true,
				SetFilesToArchive, _tmpFolder.Path);
		}

		/// ------------------------------------------------------------------------------------
		[TearDown]
		public void TearDown()
		{
			_model.CleanUp();
			_tmpFolder.Dispose();
		}
		#endregion

		#region Miscellaneous Tests
		/// ------------------------------------------------------------------------------------
		[Test]
		public void NormalizeFilename_FileName_NormalizedFileName()
		{
			const string fileName = "My# \nFile %\t Name&^%.mp3";
			var normalized = _model.NormalizeFilename("", fileName);
			Assert.AreEqual("My+File+Name_.mp3", normalized);
		}

		/// ------------------------------------------------------------------------------------
		[Test]
		public void CorpusDirectoryName_ValidNameForNewDirectory()
		{
			var dirName = _model.CorpusDirectoryName;

			Assert.AreEqual(21, dirName.Length);
			Assert.AreEqual("T_st_Title_", dirName.Substring(0, 11));
		}
		#endregion
{'fraction_non_alphanumeric': 0.2601646937725167, 'fraction_numerical': 0.0023160061760164694, 'mean_word_length': 2.1046325878594248, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6266918', 'n_tokens_mistral': 1188, 'n_tokens_neox': 1075, 'n_words': 236}