예제 #1
0
        public void Test_Common()
        {
            using (GDMIndividualAttribute customEvent = new GDMIndividualAttribute()) {
                Assert.IsNotNull(customEvent);

                Assert.IsNotNull(customEvent.Address);

                customEvent.Date.ParseString("28 DEC 1990");
                string dateTest = "28.12.1990";
                Assert.AreEqual(TestUtils.ParseDT(dateTest), customEvent.Date.GetDateTime());
                Assert.AreEqual(1990, customEvent.GetChronologicalYear());

                Assert.AreEqual(TestUtils.ParseDT(dateTest), customEvent.Date.Date);
                customEvent.Place.ParseString("Ivanovo");
                Assert.AreEqual("Ivanovo", customEvent.Place.StringValue);

                Assert.IsNotNull(customEvent.Place);

                customEvent.Agency = "test agency";
                Assert.AreEqual("test agency", customEvent.Agency);

                customEvent.Classification = "test type";
                Assert.AreEqual("test type", customEvent.Classification);

                customEvent.Cause = "test cause";
                Assert.AreEqual("test cause", customEvent.Cause);

                customEvent.ReligiousAffilation = "test aff";
                Assert.AreEqual("test aff", customEvent.ReligiousAffilation);

                customEvent.Restriction = GDMRestriction.rnLocked;
                Assert.AreEqual(GDMRestriction.rnLocked, customEvent.Restriction);


                GDMLines strs = new GDMLines("test");
                customEvent.PhysicalDescription = strs;
                Assert.AreEqual(strs.Text, customEvent.PhysicalDescription.Text);

                customEvent.Address.AddEmailAddress("email");
                Assert.AreEqual("email", customEvent.Address.EmailAddresses[0].StringValue);
            }

            using (GDMIndividualEvent customEvent = new GDMIndividualEvent()) {
                Assert.IsNotNull(customEvent);

                // stream test
                customEvent.SetName(GEDCOMTagName.BIRT);
                customEvent.Date.ParseString("20 SEP 1970");
                customEvent.Place.StringValue   = "test place";
                customEvent.Agency              = "Agency";
                customEvent.Classification      = "custom";
                customEvent.ReligiousAffilation = "rel_aff";
                customEvent.Cause = "Cause";
                customEvent.Address.AddressLine1 = "adr1";
                customEvent.Restriction          = GDMRestriction.rnConfidential;

                var note = new GDMNotes();
                note.Lines.Text = "event notes";
                customEvent.Notes.Add(note);

                var sourCit = new GDMSourceCitation();
                sourCit.Description.Text = "event sour desc";
                customEvent.SourceCitations.Add(sourCit);

                var mmLink = new GDMMultimediaLink();
                mmLink.Title = "event media title";
                customEvent.MultimediaLinks.Add(mmLink);

                using (GDMIndividualEvent copyEvent = new GDMIndividualEvent()) {
                    Assert.IsNotNull(copyEvent);
                    copyEvent.Assign(customEvent);

                    var iRec = new GDMIndividualRecord(null);
                    iRec.Events.Add(copyEvent);
                    string buf1 = TestUtils.GetTagStreamText(iRec, 0);
                    Assert.AreEqual("0 INDI\r\n" +
                                    "1 SEX U\r\n" +
                                    "1 BIRT\r\n" +
                                    "2 TYPE custom\r\n" +
                                    "2 DATE 20 SEP 1970\r\n" +
                                    "2 PLAC test place\r\n" +
                                    "2 ADDR\r\n" +
                                    "3 ADR1 adr1\r\n" +
                                    "2 CAUS Cause\r\n" +
                                    "2 AGNC Agency\r\n" +
                                    "2 RELI rel_aff\r\n" +
                                    "2 RESN confidential\r\n" +
                                    "2 NOTE event notes\r\n" +
                                    "2 SOUR event sour desc\r\n" +
                                    "2 OBJE\r\n" +
                                    "3 TITL event media title\r\n", buf1);
                }

                customEvent.Address.AddEmailAddress("email");
                Assert.AreEqual("email", customEvent.Address.EmailAddresses[0].StringValue);
            }

            using (GDMFamilyEvent customEvent = new GDMFamilyEvent()) {
                Assert.IsNotNull(customEvent);

                customEvent.Address.AddEmailAddress("email");
                Assert.AreEqual("email", customEvent.Address.EmailAddresses[0].StringValue);
            }
        }
예제 #2
0
        public void Test_Common()
        {
            using (GDMIndividualAttribute customEvent = new GDMIndividualAttribute(null)) {
                Assert.IsNotNull(customEvent);

                Assert.IsNotNull(customEvent.Address);

                customEvent.Date.ParseString("28 DEC 1990");
                string dateTest = "28.12.1990";
                Assert.AreEqual(TestUtils.ParseDT(dateTest), customEvent.Date.GetDateTime());
                Assert.AreEqual(1990, customEvent.GetChronologicalYear());

                Assert.AreEqual(TestUtils.ParseDT(dateTest), customEvent.Date.Date);
                customEvent.Place.ParseString("Ivanovo");
                Assert.AreEqual("Ivanovo", customEvent.Place.StringValue);

                Assert.IsNotNull(customEvent.Place);

                customEvent.Agency = "test agency";
                Assert.AreEqual("test agency", customEvent.Agency);

                customEvent.Classification = "test type";
                Assert.AreEqual("test type", customEvent.Classification);

                customEvent.Cause = "test cause";
                Assert.AreEqual("test cause", customEvent.Cause);

                customEvent.ReligiousAffilation = "test aff";
                Assert.AreEqual("test aff", customEvent.ReligiousAffilation);

                customEvent.Restriction = GDMRestriction.rnLocked;
                Assert.AreEqual(GDMRestriction.rnLocked, customEvent.Restriction);


                StringList strs = new StringList("test");
                customEvent.PhysicalDescription = strs;
                Assert.AreEqual(strs.Text, customEvent.PhysicalDescription.Text);

                customEvent.Address.AddEmailAddress("email");
                Assert.AreEqual("email", customEvent.Address.EmailAddresses[0].StringValue);
            }

            using (GDMIndividualEvent customEvent = new GDMIndividualEvent(null)) {
                Assert.IsNotNull(customEvent);

                // stream test
                customEvent.SetName(GEDCOMTagName.BIRT);
                customEvent.Date.ParseString("20 SEP 1970");
                customEvent.Place.StringValue   = "test place";
                customEvent.Agency              = "Agency";
                customEvent.Classification      = "custom";
                customEvent.ReligiousAffilation = "rel_aff";
                customEvent.Cause = "Cause";
                customEvent.Address.AddressLine1 = "adr1";
                customEvent.Restriction          = GDMRestriction.rnConfidential;

                using (GDMIndividualEvent copyEvent = new GDMIndividualEvent(null)) {
                    Assert.IsNotNull(copyEvent);
                    copyEvent.Assign(customEvent);

                    string buf1 = TestUtils.GetTagStreamText(copyEvent, 0);
                    Assert.AreEqual("0 BIRT\r\n" +
                                    "1 TYPE custom\r\n" +
                                    "1 DATE 20 SEP 1970\r\n" +
                                    "1 PLAC test place\r\n" +
                                    "1 ADDR\r\n" +
                                    "2 ADR1 adr1\r\n" +
                                    "1 CAUS Cause\r\n" +
                                    "1 AGNC Agency\r\n" +
                                    "1 RELI rel_aff\r\n" +
                                    "1 RESN confidential\r\n", buf1);
                }

                customEvent.Address.AddEmailAddress("email");
                Assert.AreEqual("email", customEvent.Address.EmailAddresses[0].StringValue);
            }

            using (GDMFamilyEvent customEvent = new GDMFamilyEvent(null)) {
                Assert.IsNotNull(customEvent);

                customEvent.Address.AddEmailAddress("email");
                Assert.AreEqual("email", customEvent.Address.EmailAddresses[0].StringValue);
            }
        }