Example #1
0
        public void ProcessParagraphUnit_WhenTargetPathIsEmpty_ShouldTakeSourcePathAsTargetPath()
        {
            // Arrange
            var testee = CreateTestee(TheSourcePath, null);

            // Act
            testee.ProcessParagraphUnit(_paragraphUnitMock);

            // Assert
            A.CallTo(() => _yamlTextWriter.Write(TheSourcePath, A <string> .Ignored)).MustHaveHappened();
        }
        public void ProcessParagraphUnit(IParagraphUnit paragraphUnit)
        {
            var locationContextInfo = paragraphUnit.Properties.Contexts.Contexts[1];
            var sourcePath          = locationContextInfo.GetMetaData(ContextKeys.SourcePath);
            var targetPath          = locationContextInfo.GetMetaData(ContextKeys.TargetPath);

            if (string.IsNullOrEmpty(targetPath))
            {
                targetPath = sourcePath;
            }

            var targetText = _segmentReader.GetText(paragraphUnit.Target);

            _yamlTextWriter.Write(targetPath, targetText);
        }