Beispiel #1
0
        public void GetSegments_NoTarget_NullTargetSegments()
        {
            var segments = Parser.ParseFile(
                Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TaggedFile.txt"));

            var file = new File
            {
                SourceCulture = CultureInfo.GetCultureInfo("en-us"),
                TargetCulture = CultureInfo.GetCultureInfo("fr")
            };

            var xliff = new Xliff
            {
                File = file
            };

            foreach (var segment in segments)
            {
                xliff.AddSourceSegment(segment);
            }

            var targetSegments = xliff.GetTargetSegments();

            foreach (var segment in targetSegments)
            {
                Assert.IsNull(segment);
            }
        }
Beispiel #2
0
        public void GetSegments_TaggedText_SameAsSource()
        {
            var segments = Parser.ParseFile(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TaggedFile.txt"));

            var file = new File
            {
                SourceCulture = CultureInfo.GetCultureInfo("en-us"),
                TargetCulture = CultureInfo.GetCultureInfo("fr")
            };

            var xliff = new Xliff
            {
                File = file
            };


            foreach (var segment in segments)
            {
                xliff.AddTranslation(segment, segment, "MTEdge");
            }

            var targetSegments = xliff.GetTargetSegments();

            for (int i = 0; i < segments.Length; i++)
            {
                Assert.AreEqual(segments[i].ToString(), targetSegments[i].ToString());
            }
        }