public void ShouldReturnAllTextAsOneFragment()
        {
            var sut     = new PlainTextExtractor();
            var results = sut.Extract("Some text".AsMemory(), 10);

            results.Select(r => (r.Offset, r.Text.ToString()))
            .Should().BeEquivalentTo(
                (10, "Some text")
                );
        }
Esempio n. 2
0
        public QueryParserTests()
        {
            this.fieldLookupMock = new Mock <IIndexedFieldLookup>();
            var testFieldId  = TestFieldId;
            var otherFieldId = OtherFieldId;

            var tokenizer     = new FakeTokenizer();
            var textExtractor = new PlainTextExtractor();

            this.fieldLookupMock.Setup(l => l.GetFieldInfo("testfield")).Returns(new IndexedFieldDetails(testFieldId, textExtractor, tokenizer));
            this.fieldLookupMock.Setup(l => l.GetFieldInfo("otherfield")).Returns(new IndexedFieldDetails(otherFieldId, textExtractor, tokenizer));
        }
 public override void ProcessParagraphUnit(IParagraphUnit paragraphUnit)
 {
     SourceText.Add(PlainTextExtractor.GetPlainText(paragraphUnit.Source));
     TargetText.Add(PlainTextExtractor.GetPlainText(paragraphUnit.Target));
     base.ProcessParagraphUnit(paragraphUnit);
 }