Exemple #1
0
        public void SenseParser_CanParseSense_Learner_Apple()
        {
            var content     = TestHelper.LoadResponseFromFile("sense_learn_apple");
            var definition  = JsonConvert.DeserializeObject <Definition>(content, Converter.Settings);
            var senseParser = new SenseParser(definition, Language.NotApplicable, ParseOptions.Default);

            // ACT
            var def = new Dto.Definition();

            senseParser.Parse(def);

            // ASSERT
            var dts = GetDefiningTexts(new[] { def });

            dts.OfType <SupplementalInformationNote>().ShouldNotBeEmpty();
        }
Exemple #2
0
        public void SenseParser_CanParseSense_Medical_Doctor()
        {
            var content     = TestHelper.LoadResponseFromFile("sense_med_doctor");
            var definition  = JsonConvert.DeserializeObject <Definition>(content, Converter.Settings);
            var senseParser = new SenseParser(definition, Language.NotApplicable, ParseOptions.Default);

            // ACT
            var def = new Dto.Definition();

            senseParser.Parse(def);

            // ASSERT
            // verify that the divided sense has been parsed
            def.SenseSequence
            .SelectMany(ss => ss.Senses)
            .Cast <Sense>()
            .Where(s => s.DividedSense != null)
            .ShouldNotBeEmpty();
        }
Exemple #3
0
        public void SenseParser_CanParseSense_Above()
        {
            var content     = TestHelper.LoadResponseFromFile("sense_above");
            var definition  = JsonConvert.DeserializeObject <Definition>(content, Converter.Settings);
            var senseParser = new SenseParser(definition, Language.NotApplicable, ParseOptions.Default);

            // ACT
            var def = new Dto.Definition();

            senseParser.Parse(def);

            // ASSERT
            def.SenseSequence.Count.ShouldBe(1);
            def.SenseSequence.First().Senses.Count.ShouldBe(4);

            var dts = GetDefiningTexts(new[] { def }).ToList();

            dts.OfType <DefiningText>().ShouldAllBe(t => !t.Text.Text.Contains("{wi}"));
            dts.OfType <VerbalIllustration>().ShouldAllBe(vis => !vis.Sentence.Text.Contains("{wi}"));
        }