SIL.FieldWorks.IText.InterlinSfmImportTests.MultipleTexts C# (CSharp) Method

MultipleTexts() private method

private MultipleTexts ( ) : void
return void
		public void MultipleTexts()
		{
			var mappings = GetMappings();
			mappings.Add(new InterlinearMapping() { Marker = "id", Destination = InterlinDestination.Id, WritingSystem = "en" });
			mappings.Add(new InterlinearMapping() { Marker = "ab", Destination = InterlinDestination.Abbreviation, WritingSystem = "en" });
			var wsf = GetWsf();
			var input = new ByteReader("input3", Encoding.GetEncoding(1252).GetBytes(input3));
			var converter = new Sfm2FlexText();
			var output = converter.Convert(input, mappings, wsf);
			using (var outputStream = new MemoryStream(output))
			{
				using (var reader = new StreamReader(outputStream))
				{
					var outputElt = XElement.Load(reader);
					var textElt = outputElt.Element("interlinear-text");
					VerifyItem(textElt, "./item[@type='title-abbreviation']", "en", "Abu");
					var phrase1 = textElt.XPathSelectElement("./paragraphs/paragraph/phrases/phrase");
					VerifyText(phrase1, new[] { "John", "added", "this" },
						new HashSet<string>(), "qaa-x-kal");

					//\id
					//\ab MyT
					//\name MyText
					//\com Some coments
					//\com more comments
					//\p
					//\ref MyText 001
					//\t Some text
					textElt = outputElt.Elements("interlinear-text").Skip(1).First();
					VerifyItem(textElt, "./item[@type='title-abbreviation']", "en", "MyT");
					VerifyItem(textElt, "./item[@type='title']", "fr", "MyText");
					VerifyItem(textElt, "./item[@type='comment']", "en", "Some coments more comments");
					phrase1 = textElt.XPathSelectElement("./paragraphs/paragraph/phrases/phrase");
					VerifyText(phrase1, new[] { "Some", "text" }, new HashSet<string>(), "qaa-x-kal");

					// Verifies that:
					//	- \name can occur twice and be concatenated
					//	- \name can force the start of a new text
					//	- a subsequent \name not following some content is ignored
					//\name Another
					//\name Text
					//\com More comments
					//\name this is ignored
					//\p
					//\ref AT 001
					//\t third text
					textElt = outputElt.Elements("interlinear-text").Skip(2).First();
					VerifyItem(textElt, "./item[@type='title']", "fr", "Another Text");
					VerifyItem(textElt, "./item[@type='comment']", "en", "More comments");
					phrase1 = textElt.XPathSelectElement("./paragraphs/paragraph/phrases/phrase");
					VerifyText(phrase1, new[] { "third", "text" }, new HashSet<string>(), "qaa-x-kal");

					// Verifies that:
					//	- \id can force the start of a new text
					//  - \ab does not start yet another (when no intervening content)
					//\id
					//\ab Yet
					//\name Yet another
					//\p
					//\ref Yet 001
					//\t fourth text			textElt = outputElt.Elements("interlinear-text").Skip(2).First();
					textElt = outputElt.Elements("interlinear-text").Skip(3).First();
					VerifyItem(textElt, "./item[@type='title']", "fr", "Yet another");
					VerifyItem(textElt, "./item[@type='title-abbreviation']", "en", "Yet");
					phrase1 = textElt.XPathSelectElement("./paragraphs/paragraph/phrases/phrase");
					VerifyText(phrase1, new[] { "fourth", "text" }, new HashSet<string>(), "qaa-x-kal");
				}
			}
		}