예제 #1
0
        public void SegmentParser_CreateSegment_WithEscaped()
        {
            ScoringResult  scoringResult  = new ScoringResult();
            SearchSettings searchSettings = new SearchSettings();
            CultureInfo    culture        = CultureInfo.GetCultureInfo("en-US");
            string         matchResult    = "<ut Type=\"start\" RightEdge=\"angle\">&lt;f&quot;TimesNewRomanPSMT&quot;&gt;</ut>Effectively managing employee meals means balancing profit objectives with people objectives.";

            var actual = SegmentParser.CreateSegment(scoringResult, searchSettings, matchResult, culture);

            Assert.AreEqual("<f\"TimesNewRomanPSMT\">Effectively managing employee meals means balancing profit objectives with people objectives.", actual.ToPlain());
        }
예제 #2
0
        public void SegmentParser_CreateSegment_OneStartTagWithoutEscaped()
        {
            ScoringResult  scoringResult  = new ScoringResult();
            SearchSettings searchSettings = new SearchSettings();
            CultureInfo    culture        = CultureInfo.GetCultureInfo("en-US");
            string         matchResult    = "<ut Type=\"start\" RightEdge=\"angle\">Effectively managing employee meals means balancing profit objectives with people objectives.";

            var actual = SegmentParser.CreateSegment(scoringResult, searchSettings, matchResult, culture);

            Assert.IsTrue(actual.ToString().Contains("Effectively managing employee meals means balancing profit objectives with people objectives."));
            Assert.AreEqual("Effectively managing employee meals means balancing profit objectives with people objectives.", actual.ToPlain());
        }
예제 #3
0
        public void SegmentParser_CreateSegment_GeneralAndPlainString()
        {
            ScoringResult  scoringResult  = new ScoringResult();
            SearchSettings searchSettings = new SearchSettings();
            CultureInfo    culture        = CultureInfo.GetCultureInfo("en-US");
            string         matchResult    = "some plain string";

            var actual = SegmentParser.CreateSegment(scoringResult, searchSettings, matchResult, culture);

            Assert.AreEqual(CultureInfo.GetCultureInfo("en-US"), actual.Culture);
            Assert.AreEqual("en-US", actual.CultureName);
            Assert.AreEqual(1, actual.Elements.Count);
            Assert.IsFalse(actual.HasPairedTags);
            Assert.IsFalse(actual.HasPlaceables);
            Assert.IsFalse(actual.HasTags);
            Assert.IsFalse(actual.IsEmpty);
            Assert.IsTrue(actual.IsValid());
            Assert.AreEqual("some plain string", actual.ToPlain());
            Assert.AreEqual("some plain string", actual.ToString());
        }