Exemple #1
0
        public void Test_Assign()
        {
            var instance = new GDMFileReferenceWithTitle(null);

            Assert.Throws(typeof(ArgumentException), () => {
                instance.Assign(null);
            });
        }
Exemple #2
0
        public string GetFileTitle()
        {
            if (fFileReferences.Count <= 0)
            {
                return(string.Empty);
            }

            GDMFileReferenceWithTitle fileRef = fFileReferences[0];

            return(fileRef.Title);
        }
Exemple #3
0
        public void Test_Common()
        {
            GDMIndividualRecord indiv = fContext.Tree.CreateIndividual();

            using (GDMMultimediaRecord mediaRec = fContext.Tree.CreateMultimedia()) {
                Assert.IsNotNull(mediaRec);

                mediaRec.ResetOwner(fContext.Tree);
                Assert.AreEqual(fContext.Tree, mediaRec.GetTree());

                Assert.AreEqual("", mediaRec.GetFileTitle());

                mediaRec.FileReferences.Add(new GDMFileReferenceWithTitle(mediaRec));
                GDMFileReferenceWithTitle fileRef = mediaRec.FileReferences[0];
                Assert.IsNotNull(fileRef);

                fileRef.Title = "File Title 2";
                Assert.AreEqual("File Title 2", fileRef.Title);

                fileRef.LinkFile("sample.png");
                fileRef.MediaType = GDMMediaType.mtManuscript;
                Assert.AreEqual("sample.png", fileRef.StringValue);
                Assert.AreEqual(GDMMultimediaFormat.mfPNG, fileRef.MultimediaFormat);
                Assert.AreEqual(GDMMediaType.mtManuscript, fileRef.MediaType);

                string title = mediaRec.GetFileTitle();
                Assert.AreEqual("File Title 2", title);

                using (GDMMultimediaRecord media2 = fContext.Tree.CreateMultimedia()) {
                    Assert.Throws(typeof(ArgumentException), () => {
                        media2.Assign(null);
                    });

                    media2.Assign(mediaRec);

                    string buf = TestUtils.GetTagStreamText(media2, 0);
                    Assert.AreEqual("0 @O3@ OBJE\r\n" +
                                    "1 FILE sample.png\r\n" +
                                    "2 FORM png\r\n" +
                                    "3 TYPE manuscript\r\n" +
                                    "2 TITL File Title 2\r\n", buf);
                }

                mediaRec.ReplaceXRefs(new GDMXRefReplacer());

                GEDCOMMultimediaLinkTest(mediaRec, indiv);

                Assert.IsFalse(mediaRec.IsEmpty());
                mediaRec.Clear();
                Assert.IsTrue(mediaRec.IsEmpty());
            }
        }
        public override void Assign(GDMTag source)
        {
            GDMFileReferenceWithTitle srcObj = (source as GDMFileReferenceWithTitle);

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

            base.Assign(source);

            fTitle = srcObj.fTitle;
        }
Exemple #5
0
        public void Test_Clear()
        {
            var instance = new GDMFileReferenceWithTitle(null);

            instance.Clear();
        }