コード例 #1
0
        public void Test_Common()
        {
            using (GDMSubmitterRecord subrRec = new GDMSubmitterRecord(fContext.Tree)) {
                subrRec.Name.StringValue = "Test Submitter";
                Assert.AreEqual("Test Submitter", subrRec.Name.StringValue);

                subrRec.RegisteredReference = "regref";
                Assert.AreEqual("regref", subrRec.RegisteredReference);

                var lang = new GDMLanguage(subrRec);
                lang.ParseString("Russian");
                subrRec.Languages.Add(lang);
                Assert.AreEqual("Russian", subrRec.Languages[0].StringValue);

                subrRec.SetLanguage(0, "nothing"); // return without exceptions

                subrRec.SetLanguage(1, "English");
                Assert.AreEqual("English", subrRec.Languages[1].StringValue);

                Assert.IsNotNull(subrRec.Address);

                subrRec.ReplaceXRefs(new GDMXRefReplacer());


                Assert.IsFalse(subrRec.IsEmpty());
                subrRec.Clear();
                Assert.IsTrue(subrRec.IsEmpty());


                subrRec.ResetOwner(fContext.Tree);
                Assert.AreEqual(fContext.Tree, subrRec.GetTree());
            }
        }
コード例 #2
0
ファイル: GDMLanguage.cs プロジェクト: m-kosina/GEDKeeper
        public override void Assign(GDMTag source)
        {
            GDMLanguage srcLang = (source as GDMLanguage);

            if (srcLang == null)
            {
                throw new ArgumentException(@"Argument is null or wrong type", "source");
            }

            base.Assign(source);

            fValue = srcLang.fValue;
        }
コード例 #3
0
ファイル: GDMHeaderTests.cs プロジェクト: subratb/GEDKeeper
        public void Test_GDMLanguage()
        {
            using (GDMLanguage langTag = new GDMLanguage(null)) {
                Assert.IsTrue(langTag.IsEmpty());

                langTag.Value = GDMLanguageID.AngloSaxon;
                Assert.AreEqual(GDMLanguageID.AngloSaxon, langTag.Value);

                langTag.ParseString("Spanish");
                Assert.AreEqual("Spanish", langTag.StringValue);

                using (GDMLanguage langTag2 = new GDMLanguage(null)) {
                    Assert.IsTrue(langTag2.IsEmpty());

                    Assert.Throws(typeof(ArgumentException), () => { langTag2.Assign(null); });

                    langTag2.Assign(langTag);
                    Assert.AreEqual("Spanish", langTag2.StringValue);
                }

                langTag.Clear();
                Assert.IsTrue(langTag.IsEmpty());
            }
        }
コード例 #4
0
 public GDMLanguage AddLanguage(GDMLanguage value)
 {
     fLanguages.Add(value);
     return(value);
 }