Example #1
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());
            }
        }
        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());
            }
        }