コード例 #1
0
ファイル: GDMRecord.cs プロジェクト: loxadim/GEDKeeper
        public void AddUserRef(string reference)
        {
            GDMUserReference uRef = new GDMUserReference(this);

            uRef.StringValue = reference;
            fUserReferences.Add(uRef);
        }
コード例 #2
0
        public void Test_Common()
        {
            using (GDMUserReference userRef = new GDMUserReference(null)) {
                Assert.IsNotNull(userRef);

                userRef.StringValue = "ref";

                userRef.ReferenceType = "test";
                Assert.AreEqual("test", userRef.ReferenceType);

                using (GDMUserReference uref2 = new GDMUserReference(null)) {
                    Assert.IsNotNull(uref2);

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

                    uref2.Assign(userRef);

                    string buf = TestUtils.GetTagStreamText(uref2, 1);
                    Assert.AreEqual("1 REFN ref\r\n" +
                                    "2 TYPE test\r\n", buf);
                }

                Assert.IsFalse(userRef.IsEmpty());
                userRef.Clear();
                Assert.IsTrue(userRef.IsEmpty());
            }
        }
コード例 #3
0
        public void Test_Common()
        {
            using (GDMUserReference userRef = new GDMUserReference()) {
                Assert.IsNotNull(userRef);

                userRef.StringValue = "ref";

                userRef.ReferenceType = "test";
                Assert.AreEqual("test", userRef.ReferenceType);

                using (GDMUserReference uref2 = new GDMUserReference()) {
                    Assert.IsNotNull(uref2);

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

                    uref2.Assign(userRef);

                    // test of output format
                    var iRec = new GDMIndividualRecord(null);
                    iRec.UserReferences.Add(uref2);
                    string buf = TestUtils.GetTagStreamText(iRec, 0);
                    Assert.AreEqual("0 INDI\r\n" +
                                    "1 REFN ref\r\n" +
                                    "2 TYPE test\r\n" +
                                    "1 SEX U\r\n", buf);
                }

                Assert.IsFalse(userRef.IsEmpty());
                userRef.Clear();
                Assert.IsTrue(userRef.IsEmpty());
            }
        }
コード例 #4
0
        public override void Assign(GDMTag source)
        {
            GDMUserReference srcUserRef = (source as GDMUserReference);

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

            base.Assign(source);

            fReferenceType = srcUserRef.fReferenceType;
        }