public void XliffWriter_FullDocument() { File file; Group group1; Group group2; Ignorable ignorable; Note note; Segment segment; Skeleton skeleton; Unit unit; string actualValue; this._document.SourceLanguage = "en-us"; this._document.Space = Preservation.Default; this._document.TargetLanguage = "de-de"; this._document.Version = "version"; file = new File(); file.CanResegment = true; file.Id = "id"; file.Original = "original"; file.SourceDirectionality = ContentDirectionality.LTR; file.Space = Preservation.Preserve; file.TargetDirectionality = ContentDirectionality.RTL; file.Translate = true; this._document.Files.Add(file); group1 = new Group(); group1.CanResegment = true; group1.Id = "id"; group1.Name = "name"; group1.SourceDirectionality = ContentDirectionality.RTL; group1.Space = Preservation.Preserve; group1.TargetDirectionality = ContentDirectionality.Auto; group1.Translate = true; group1.Type = "type"; file.Containers.Add(group1); group2 = new Group(); group2.CanResegment = false; group2.Id = "id2"; group2.Name = "name2"; group2.SourceDirectionality = ContentDirectionality.LTR; group2.Space = Preservation.Default; group2.TargetDirectionality = ContentDirectionality.RTL; group2.Translate = false; group2.Type = "type2"; file.Containers.Add(group2); unit = new Unit(); unit.CanResegment = false; unit.Id = "id"; unit.Name = "name"; unit.Notes.Add(new Note("text")); unit.SourceDirectionality = ContentDirectionality.LTR; unit.Space = Preservation.Default; unit.TargetDirectionality = ContentDirectionality.Auto; unit.Translate = true; unit.Type = "type"; group2.Containers.Add(unit); unit.OriginalData = new OriginalData(); unit.OriginalData.AddData("id", "data1"); unit.OriginalData.DataElements[0].Directionality = ContentDirectionality.RTL; unit.OriginalData.DataElements[0].Space = Preservation.Preserve; unit.OriginalData.DataElements[0].Text.Add(new CodePoint(1)); unit = new Unit(); unit.CanResegment = false; unit.Id = "id2"; unit.Name = "name2"; unit.Notes.Add(new Note("text2")); unit.SourceDirectionality = ContentDirectionality.RTL; unit.Space = Preservation.Preserve; unit.TargetDirectionality = ContentDirectionality.LTR; unit.Translate = false; unit.Type = "type2"; group2.Containers.Add(unit); unit.OriginalData = new OriginalData(); unit.OriginalData.AddData("id1", "data1"); unit.OriginalData.DataElements[0].Directionality = ContentDirectionality.LTR; unit.OriginalData.DataElements[0].Space = Preservation.Preserve; unit.OriginalData.DataElements[0].Text.Add(new CodePoint(2)); unit.OriginalData.AddData("id2", "data2"); unit.OriginalData.DataElements[1].Directionality = ContentDirectionality.RTL; unit.OriginalData.DataElements[1].Space = Preservation.Preserve; unit.OriginalData.DataElements[1].Text.Add(new CodePoint(1)); ignorable = new Ignorable(); ignorable.Id = "id"; ignorable.Source = new Source("text"); ignorable.Target = new Target("text"); unit.Resources.Add(ignorable); segment = new Segment(); segment.CanResegment = true; segment.Id = "id"; segment.Source = new Source(); segment.State = TranslationState.Reviewed; segment.SubState = "substate"; segment.Target = new Target(); segment.Source.Language = "en-us"; segment.Source.Space = Preservation.Default; segment.Source.Text.Add(new CodePoint(1)); segment.Source.Text.Add(new PlainText("text")); segment.Target.Language = "en-us"; segment.Target.Order = 100; segment.Target.Space = Preservation.Default; segment.Target.Text.Add(new CodePoint(12)); segment.Target.Text.Add(new PlainText("text2")); unit.Resources.Add(segment); note = new Note(); note.AppliesTo = TranslationSubject.Source; note.Category = "category"; note.Id = "id"; note.Priority = 2; note.Text = "text"; file.Notes.Add(note); file.Notes.Add(new Note("text2")); skeleton = new Skeleton(); skeleton.HRef = "href"; skeleton.NonTranslatableText = "text"; file.Skeleton = skeleton; file = new File(); file.CanResegment = false; file.Id = "id2"; file.Notes.Add(new Note("text")); file.Original = "original2"; file.SourceDirectionality = ContentDirectionality.Auto; file.Space = Preservation.Default; file.TargetDirectionality = ContentDirectionality.LTR; file.Translate = false; this._document.Files.Add(file); skeleton = new Skeleton(); skeleton.HRef = "href"; skeleton.NonTranslatableText = "text"; file.Skeleton = skeleton; actualValue = this.Serialize(); Assert.AreEqual(TestUtilities.GetFileContents(TestData.FullDocument), actualValue); }
/// <summary> /// Creates a skeleton with every element and attribute. /// </summary> /// <param name="useHRef">True to use the HRef value, false to use the Text value.</param> /// <returns>The created skeleton.</returns> private Skeleton CreateSkeleton(bool useHRef) { Skeleton result; result = new Skeleton(); if (useHRef) { result.HRef = "href"; } else { result.NonTranslatableText = "text"; this.AddExtension(result); } return result; }