public void Create_WhenTargetTextIsNeeded_ShouldAddTargetText()
        {
            // Arrange
            var testee = CreateTestee();

            var entry = new Entry
            {
                MessageId     = "message id",
                MessageString = "message string",
            };

            // Act
            testee.Create(entry, LineType.MessageId, true);

            // Assert
            A.CallTo(() => _targetSegment0Mock.Add(_textMsgstrMock)).MustHaveHappened();
            A.CallTo(() => _paragraphTargetMock.Add(_targetSegment0Mock)).MustHaveHappened();
        }
        public void Create_WhenSourceLineTypeIsMessageId_ShouldUseMessageIdAsSourceText()
        {
            // Arrange
            var testee = CreateTestee();

            var entry = new Entry
            {
                MessageId     = "message id",
                MessageString = "message string",
            };

            // Act
            testee.Create(entry, LineType.MessageId, false);

            // Assert
            A.CallTo(() => _sourceSegment0Mock.Add(_textMsgidMock)).MustHaveHappened();
            A.CallTo(() => _paragraphSourceMock.Add(_sourceSegment0Mock)).MustHaveHappened();
        }
 private static void CopyParagraphContents(IParagraph fromParagraph, IParagraph toParagraph)
 {
     toParagraph.Clear();
     while (fromParagraph.Count > 0)
     {
         var item = fromParagraph[0];
         fromParagraph.RemoveAt(0);
         toParagraph.Add(item);
     }
 }
Ejemplo n.º 4
0
        public void VisitCommentMarker(ICommentMarker commentMarker)
        {
            var newComment = _itemFactory.CreateCommentMarker(commentMarker.Comments);

            _parentParagraph.Add(newComment);
            _currentContainer = newComment;

            VisitChildElements(commentMarker);

            _currentContainer = newComment.Parent;
        }
        private static void CopyParagraph(IParagraph fromParagraph, IParagraph toParagraph)
        {
            toParagraph.Clear();

            while (fromParagraph.Count > 0)
            {
                IAbstractMarkupData markupData = fromParagraph[0];
                fromParagraph.RemoveAt(0);

                toParagraph.Add(markupData);
            }
        }
Ejemplo n.º 6
0
        public static IParagraph AddSegment(this IParagraph paragraph, ISegment segment, SegmentBuilder builder)
        {
            if (segment != null)
            {
                var newSegment = builder.CreateSegment(segment.Properties.Clone() as ISegmentPairProperties);
                foreach (var item in segment)
                {
                    newSegment.Add(item?.Clone() as IAbstractMarkupData);
                }

                paragraph.Add(newSegment);
            }

            return(paragraph);
        }
        public void VisitText_WhenTextIsTextInlineType_ShouldAddText()
        {
            // Arrange
            var testee = CreateTestee();

            A.CallTo(() => _textProcessorMock.Process(TexBeforeProcessing)).Returns(new List <IFragment>
            {
                new Fragment(InlineType.Text, "text")
            });

            var textPropertiesMock = A.Fake <ITextProperties>();

            A.CallTo(() => _propertiesFactoryMock.CreateTextProperties("text")).Returns(textPropertiesMock);

            var newTextMock = A.Fake <IText>();

            A.CallTo(() => _itemFactoryMock.CreateText(textPropertiesMock)).Returns(newTextMock);

            // Act
            testee.VisitText(_textMock);

            // Assert
            A.CallTo(() => _sourceParagraphMock.Add(newTextMock)).MustHaveHappened();
        }
        private static void CopyParagraph(IParagraph fromParagraph, IParagraph toParagraph)
        {
            toParagraph.Clear();

            while (fromParagraph.Count > 0)
            {
                IAbstractMarkupData markupData = fromParagraph[0];
                fromParagraph.RemoveAt(0);

                toParagraph.Add(markupData);
            }
        }