Example #1
0
        public void ExcelFileNotExistsTest()
        {
            string query = "user=TestUser1&project=aai";

            AddManyTasks.SelectAudioFilesFolder selectAudioFolder = null;
            new AddManyTasks(query, selectAudioFolder, Path.Combine(_inputPath, "ExcelFileNotExists"));
            TextFileAssert.AreEqual(Path.Combine(_inputPath, "ExcelFileNotExists", "Summary.txt"), Path.Combine(_expectedPath, "ExcelFileNotExists", "Summary.txt"));
        }
		public void VerseNumberReplaceContentOnSameNumber()
		{
			Task currentTask = new Task();
			currentTask.ChapterNumber = 1;
			currentTask.VerseStart = 39;
			currentTask.VerseEnd = 45;
			string chapterContent = File.ReadAllText(Path.Combine(_inputPath, "WithParatextData.sfm"));
			string transcription = "This is example of replace verse with the existing one";
			string outputFilePath = Path.Combine(_outputPath, "VerseNumberReplaceContentOnSameNumber.sfm");
			string expectedFilePath = Path.Combine(_expectedPath, "VerseNumberReplaceContentOnSameNumber.sfm");
			StringBuilder sb = GenerateParatextData(currentTask, chapterContent, transcription);
			File.WriteAllText(outputFilePath, sb.ToString());
			TextFileAssert.AreEqual(outputFilePath,	expectedFilePath);
		}
		public void VerseNumberInMiddle()
		{
			Task currentTask = new Task();
			currentTask.ChapterNumber = 1;
			currentTask.VerseStart = 26;
			currentTask.VerseEnd = 38;
			string outputFilePath = Path.Combine(_outputPath, "VerseNumberInMiddle.sfm");
			string expectedFilePath = Path.Combine(_expectedPath, "VerseNumberInMiddle.sfm");
			string chapterContent = File.ReadAllText(Path.Combine(_inputPath, "WithParatextData.sfm"));
			string transcription = "the test data";
			StringBuilder sb = GenerateParatextData(currentTask, chapterContent, transcription);
			File.WriteAllText(outputFilePath, sb.ToString());
			TextFileAssert.AreEqual(outputFilePath, expectedFilePath);
		}
		public void VerseNumberAtStart()
		{
			Task currentTask = new Task();
			currentTask.ChapterNumber = 1;
			currentTask.VerseStart = 1;
			currentTask.VerseEnd = 4;
			string outputFilePath = Path.Combine(_outputPath, "VerseNumberAtStart.sfm");
			string expectedFilePath = Path.Combine(_expectedPath, "VerseNumberAtStart.sfm");
			string chapterContent = File.ReadAllText(Path.Combine(_inputPath, "WithParatextData.sfm"));
			string transcription = "This is sample case with verse number";
			StringBuilder sb = GenerateParatextData(currentTask, chapterContent, transcription);
			File.WriteAllText(outputFilePath, sb.ToString());
			TextFileAssert.AreEqual(outputFilePath, expectedFilePath);
		}
		public void VerseNumberInsertContentWhenChapterAndFirstVerseAndHeading()
		{
			Task currentTask = new Task();
			currentTask.ChapterNumber = 1;
			currentTask.VerseStart = 5;
			currentTask.VerseEnd = 25;
			string chapterContent = File.ReadAllText(Path.Combine(_inputPath, "VerseNumberInsertContentWhenExistingChapterAndVerseAndHeading.sfm"));
			string transcription = "This is sample case of second set of verse number with heading";
			string outputFilePath = Path.Combine(_outputPath, "VerseNumberInsertContentWhenChapterAndFirstVerseAndHeading.sfm");
			string expectedFilePath = Path.Combine(_expectedPath, "VerseNumberInsertContentWhenChapterAndFirstVerseAndHeading.sfm");
			StringBuilder sb = GenerateParatextData(currentTask, chapterContent, transcription, "My Section");
			File.WriteAllText(outputFilePath, sb.ToString());
			TextFileAssert.AreEqual(outputFilePath, expectedFilePath);
		}
		public void VerseNumberInsertContentWhenEndVerseDiffers()
		{
			Task currentTask = new Task();
			currentTask.ChapterNumber = 1;
			currentTask.VerseStart = 70;
			currentTask.VerseEnd = 72;
			string chapterContent = File.ReadAllText(Path.Combine(_inputPath, "WithParatextData.sfm"));
			string transcription = "some text some text some text";
			string outputFilePath = Path.Combine(_outputPath, "VerseNumberInsertContentWhenEndVerseDiffers.sfm");
			string expectedFilePath = Path.Combine(_expectedPath, "VerseNumberInsertContentWhenEndVerseDiffers.sfm");
			StringBuilder sb = GenerateParatextData(currentTask, chapterContent, transcription);
			File.WriteAllText(outputFilePath, sb.ToString());
			TextFileAssert.AreEqual(outputFilePath, expectedFilePath);
		}
		public void VerseNumberInsertContentWhenChapterNotFound()
		{
			Task currentTask = new Task();
			currentTask.ChapterNumber = 2;
			currentTask.VerseStart = 27;
			currentTask.VerseEnd = 28;
			string chapterContent = "";
			string transcription = "The text in the EAF File";
			string outputFilePath = Path.Combine(_outputPath, "VerseNumberInsertContentWhenChapterNotFound.sfm");
			string expectedFilePath = Path.Combine(_expectedPath, "VerseNumberInsertContentWhenChapterNotFound.sfm");
			StringBuilder sb = GenerateParatextData(currentTask, chapterContent, transcription);
			File.WriteAllText(outputFilePath, sb.ToString());
			TextFileAssert.AreEqual(outputFilePath, expectedFilePath);
		}