コード例 #1
0
 public void NonHomographicEntryHasNoHomographNumber()
 {
     using (var environment = new EnvironmentForTest())
     {
         LexEntry e1 = environment.MakeTestLexEntryInHeadwordWritingSystem("two");
         LexEntry e2 = environment.MakeTestLexEntryInHeadwordWritingSystem("flower");
         LexEntry e3 = environment.MakeTestLexEntryInHeadwordWritingSystem("one");
         environment.DoExport();
         environment.AssertHasAtLeastOneMatch("lift/entry[@id='" + e1.Id + "' and not(@order)]");
         environment.AssertHasAtLeastOneMatch("lift/entry[@id='" + e2.Id + "' and not(@order)]");
         environment.AssertHasAtLeastOneMatch("lift/entry[@id='" + e3.Id + "' and not(@order)]");
     }
 }
コード例 #2
0
        public void HiddenFields_AreNotOutput()
        {
            using (var environment = new EnvironmentForTest())
            {
                LexEntry e1 = environment.Repo.CreateItem();
                e1.LexicalForm[EnvironmentForTest.Green] = "sunset";
                e1.GetOrCreateProperty <MultiText>("color").SetAlternative(environment.WritingSystemIds[0], EnvironmentForTest.Red);
                environment.Repo.SaveItem(e1);

                var color = new Field(
                    "color",
                    "LexEntry",
                    environment.WritingSystemIds,
                    Field.MultiplicityType.ZeroOr1,
                    "MultiText"
                    );
                color.DisplayName = "color";
                environment.Template.Add(color);

                environment.DoExport();
                environment.AssertHasAtLeastOneMatch("lift/entry[@id='" + e1.Id + "']/field[@type='" + "color" + "']");

                //now make it invisible and it should disappear
                environment.Template.GetField("color").Enabled = false;

                environment.DoExport();
                environment.AssertNoMatchForXPath("lift/entry[@id='" + e1.Id + "']/field");
            }
        }
コード例 #3
0
        public void LexemeForm_DisabledWritingSystems_AreNotOutput()
        {
            using (var environment = new EnvironmentForTest())
            {
                LexEntry entry = environment.Repo.CreateItem();
                entry.LexicalForm.SetAlternative(environment.WritingSystemIds[1], "one");
                environment.Repo.SaveItem(entry);

                environment.DoExport();
                environment.AssertHasAtLeastOneMatch("lift/entry/lexical-unit/form[text='one']");
                environment.AssertNoMatchForXPathWithArgs("lift/entry/lexical-unit/form[text='{0}']", EnvironmentForTest.Red);
            }
        }
コード例 #4
0
        public void Export_LexicalUnitHasVoice_PhoneticMediaFieldIsOutput()
        {
            using (var environment = new EnvironmentForTest())
            {
                LexEntry e1 = environment.Repo.CreateItem();
                e1.LexicalForm[EnvironmentForTest.Red]   = "r";
                e1.LexicalForm[EnvironmentForTest.Voice] = "pretendFileName";

                environment.DoExport();
                var path = string.Format("..{0}audio{0}pretendFileName", Path.DirectorySeparatorChar);
                environment.AssertHasAtLeastOneMatch("lift/entry/pronunciation/media[@href='" + path + "']");
            }
        }
コード例 #5
0
        public void Export_ExampleSentenceHasVoice_TraitWithAudioPathIsOutput()
        {
            using (var environment = new EnvironmentForTest())
            {
                environment.Template.Add(new Field(Field.FieldNames.ExampleSentence.ToString(),
                                                   "LexExampleSentence",
                                                   environment.WritingSystemIds));

                LexEntry e1 = environment.Repo.CreateItem();
                e1.LexicalForm[EnvironmentForTest.Red] = "r";
                var sense = new LexSense(e1);
                e1.Senses.Add(sense);
                var example = new LexExampleSentence(sense);
                sense.ExampleSentences.Add(example);
                example.Sentence[EnvironmentForTest.Green] = "a sentence";
                example.Sentence[EnvironmentForTest.Voice] = "pretendFileName";

                environment.DoExport();
                environment.AssertHasAtLeastOneMatchWithArgs("lift/entry/sense/example/form[@lang='{0}']", EnvironmentForTest.Green);
                var path = string.Format("..{0}audio{0}pretendFileName", Path.DirectorySeparatorChar);
                environment.AssertHasAtLeastOneMatch("lift/entry/sense/example/trait[@name='audio' and @value='" + path + "']");
            }
        }