コード例 #1
0
        public void testReplaceXRefs()
        {
            XRefReplacer       map      = null;
            GEDCOMPersonalName instance = new GEDCOMPersonalName(null, null, "", "");

            instance.ReplaceXRefs(map);
        }
コード例 #2
0
        public void testPack()
        {
            GEDCOMPersonalName instance = new GEDCOMPersonalName(null, null, "", "");

            instance.AddTag("BLECH", null, null);
            instance.Pack();
            Assert.IsNull(instance.FindTag("BLECH", 0));
        }
コード例 #3
0
        public void testGetNameType()
        {
            GEDCOMPersonalName instance  = new GEDCOMPersonalName(null, null, "", "");
            GEDCOMNameType     expResult = GEDCOMNameType.ntNone;
            GEDCOMNameType     result    = instance.NameType;

            Assert.AreEqual(expResult, result);
        }
コード例 #4
0
        public void testIsEmpty()
        {
            GEDCOMPersonalName instance = new GEDCOMPersonalName(null, null, "", "");
            bool expResult = true;
            bool result    = instance.IsEmpty();

            Assert.AreEqual(expResult, result);
        }
コード例 #5
0
 public GEDCOMPersonalName AddPersonalName(GEDCOMPersonalName value)
 {
     if (value != null)
     {
         value.SetLevel(Level + 1);
         fPersonalNames.Add(value);
     }
     return(value);
 }
コード例 #6
0
        public void testResetOwner()
        {
            GEDCOMTree         newOwner = new GEDCOMTree();
            GEDCOMPersonalName instance = new GEDCOMPersonalName(null, null, "", "");

            instance.ResetOwner(newOwner);

            Assert.AreEqual(newOwner, instance.Owner);
        }
コード例 #7
0
        public void testSaveToStream()
        {
            StreamWriter       stream   = null;
            GEDCOMPersonalName instance = new GEDCOMPersonalName(null, null, "", "");

            Assert.Throws(typeof(NullReferenceException), () => {
                instance.SaveToStream(stream);
            });
        }
コード例 #8
0
        public void testAssign()
        {
            GEDCOMPersonalName instance = new GEDCOMPersonalName(null, null, "", "");

            GEDCOMTag source = null;

            Assert.Throws(typeof(ArgumentException), () => {
                instance.Assign(source);
            });
        }
コード例 #9
0
        public void testAddTag()
        {
            string             tagName        = "TYPE";
            string             tagValue       = "gibber";
            TagConstructor     tagConstructor = null;
            GEDCOMPersonalName instance       = new GEDCOMPersonalName(null, null, "", "");

            instance.AddTag(tagName, tagValue, tagConstructor);
            Assert.IsNotNull(instance.FindTag(tagName, 0));
        }
コード例 #10
0
        public void testParseString()
        {
            // TODO BUG return value from parsestring has no meaning (all codepaths return same)
            string             strValue  = "";
            GEDCOMPersonalName instance  = new GEDCOMPersonalName(null, null, "", "");
            string             expResult = "";
            string             result    = instance.ParseString(strValue);

            Assert.AreEqual(expResult, result);
        }
コード例 #11
0
        public void testGetStringValue()
        {
            GEDCOMPersonalName instance = new GEDCOMPersonalName(null, null, "", "");

            instance.ParseString(" Ivan Ivanoff / Fedoroff / Esquire ");

            string expResult = "Ivan Ivanoff /Fedoroff/ Esquire";

            Assert.AreEqual(expResult, instance.StringValue);
        }
コード例 #12
0
        public void testSetNameType()
        {
            GEDCOMNameType     value    = GEDCOMNameType.ntBirth;
            GEDCOMPersonalName instance = new GEDCOMPersonalName(null, null, "", "");

            instance.NameType = value;
            GEDCOMNameType result = instance.NameType;

            Assert.AreEqual(value, result);
        }
コード例 #13
0
        public void testIsEmptyF()
        {
            GEDCOMPersonalName instance = new GEDCOMPersonalName(null, null, "", "");

            instance.ParseString(" Ivan Ivanoff / Fedoroff / Esquire ");
            bool expResult = false;
            bool result    = instance.IsEmpty();

            Assert.AreEqual(expResult, result);
        }
コード例 #14
0
        public void testGetLastPart()
        {
            GEDCOMPersonalName instance = new GEDCOMPersonalName(null, null, "", "");

            instance.ParseString("Ivan/Fedoroff/ Esquire");
            string expResult = "Esquire";
            string result    = instance.LastPart;

            Assert.AreEqual(expResult, result);
        }
コード例 #15
0
        public void testGetSurname()
        {
            GEDCOMPersonalName instance = new GEDCOMPersonalName(null, null, "", "");

            instance.ParseString("Ivan/Fedoroff/");
            string expResult = "Fedoroff";
            string result    = instance.Surname;

            Assert.AreEqual(expResult, result);
        }
コード例 #16
0
        public void testGetFullName()
        {
            GEDCOMPersonalName instance = new GEDCOMPersonalName(null, null, "", "");

            instance.SetNameParts("Ivan Ivanov", "Fedoroff", "");
            string expResult = "Ivan Ivanov Fedoroff";
            string result    = instance.FullName;

            Assert.AreEqual(expResult, result);
        }
コード例 #17
0
        public void testCreate()
        {
            GEDCOMTree   owner     = null;
            GEDCOMObject parent    = null;
            string       tagName   = "";
            string       tagValue  = "";
            GEDCOMTag    expResult = null;
            GEDCOMTag    result    = GEDCOMPersonalName.Create(owner, parent, tagName, tagValue);

            Assert.IsNotNull(result);
        }
コード例 #18
0
        public void testIsMatch5()
        {
            GEDCOMPersonalName instance1 = new GEDCOMPersonalName(null, null, "", "");

            instance1.ParseString("Ivan Ivanoff /Fedoroff/");
            bool  onlyFirstPart = false;
            float expResult     = 0.0F;
            float result        = instance1.IsMatch(null, onlyFirstPart);

            Assert.AreEqual(expResult, result, 0.0);
        }
コード例 #19
0
        public void testParseString2()
        {
            string             strValue  = "Pytor /the great";
            GEDCOMPersonalName instance  = new GEDCOMPersonalName(null, null, "", "");
            string             expResult = "Pytor";

            instance.ParseString(strValue);
            string result = instance.FullName;

            Assert.AreEqual(expResult, result);
        }
コード例 #20
0
        public void testSetNamePartsNull()
        {
            string             firstPart = "Ivan Ivanoff";
            string             surname   = "Fedoroff";
            string             lastPart  = null;
            GEDCOMPersonalName instance  = new GEDCOMPersonalName(null, null, "", "");

            instance.SetNameParts(firstPart, surname, lastPart);

            Assert.AreEqual("Ivan Ivanoff Fedoroff", instance.FullName);
        }
コード例 #21
0
        public void testSetLastPart()
        {
            GEDCOMPersonalName instance = new GEDCOMPersonalName(null, null, "", "");

            instance.ParseString("Ivan/Fedoroff/ Esquire");
            string value = "the III";

            instance.LastPart = value;
            string result = instance.LastPart;

            Assert.AreEqual(value, result);
        }
コード例 #22
0
        public void testSetSurname()
        {
            GEDCOMPersonalName instance = new GEDCOMPersonalName(null, null, "", "");

            instance.ParseString("Ivan/Fedoroff/");
            string value = "Yaga";

            instance.Surname = value;
            string result    = instance.FullName;
            string expResult = "Ivan Yaga";

            Assert.AreEqual(expResult, result);
        }
コード例 #23
0
        public void testSetNameParts()
        {
            string             firstPart = "Ivan Ivanoff";
            string             surname   = "Fedoroff";
            string             lastPart  = "Esquire";
            GEDCOMPersonalName instance  = new GEDCOMPersonalName(null, null, "", "");

            instance.SetNameParts(firstPart, surname, lastPart);
            string result    = instance.FullName;
            string expResult = "Ivan Ivanoff Fedoroff Esquire";

            Assert.AreEqual(expResult, result);
        }
コード例 #24
0
        public void testIsMatch9()
        {
            GEDCOMPersonalName instance1 = new GEDCOMPersonalName(null, null, "", "");

            instance1.ParseString("Vasiliy Pupkin");
            GEDCOMPersonalName instance2 = new GEDCOMPersonalName(null, null, "", "");

            instance2.SetNameParts("Vasiliy Pupkin", "", "");
            bool  onlyFirstPart = false;
            float expResult     = 100.0F;
            float result        = instance1.IsMatch(instance2, onlyFirstPart);

            Assert.AreEqual(expResult, result, 0.0);
        }
コード例 #25
0
        public void testIsMatch4()
        {
            GEDCOMPersonalName instance1 = new GEDCOMPersonalName(null, null, "", "");

            instance1.ParseString("Ivan Ivanoff /Fedoroff/");
            GEDCOMPersonalName instance2 = new GEDCOMPersonalName(null, null, "", "");

            instance2.SetNameParts("Pyotr", "Fedoroff", "Esquire");
            bool  onlyFirstPart = false;
            float expResult     = 100.0F;
            float result        = instance1.IsMatch(instance2, onlyFirstPart);

            Assert.AreNotEqual(expResult, result);
        }
コード例 #26
0
        public void testIsMatch8()
        {
            GEDCOMPersonalName instance1 = new GEDCOMPersonalName(null, null, "", "");

            instance1.ParseString("Ivan Ivanoff /?/");

            GEDCOMPersonalName instance2 = new GEDCOMPersonalName(null, null, "", "");

            instance2.SetNameParts("Ivan Ivanoff", "Unknown", "");

            bool  onlyFirstPart = false;
            float result        = instance1.IsMatch(instance2, onlyFirstPart);

            Assert.AreEqual(100.0f, result, 0.0);
        }
コード例 #27
0
        public void testIsMatch1()
        {
            GEDCOMPersonalName instance1 = new GEDCOMPersonalName(null, null, "", "");

            instance1.ParseString("Ivan Ivanoff /Fedoroff/");

            GEDCOMPersonalName instance2 = new GEDCOMPersonalName(null, null, "", "");

            instance2.ParseString("Ivan Ivanoff");

            bool  onlyFirstPart = true;
            float result        = instance1.IsMatch(instance2, onlyFirstPart);

            Assert.AreEqual(100.0f, result, 0.0);
        }
コード例 #28
0
        public override void Assign(GEDCOMTag source)
        {
            GEDCOMPersonalName otherName = (source as GEDCOMPersonalName);

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

            base.Assign(otherName);

            fFirstPart = otherName.fFirstPart;
            fSurname   = otherName.fSurname;
            fLastPart  = otherName.fLastPart;

            fPieces.Assign(otherName.Pieces);
        }
コード例 #29
0
        public override void Assign(GEDCOMTag source)
        {
            GEDCOMIndividualRecord sourceRec = source as GEDCOMIndividualRecord;

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

            base.Assign(source);

            foreach (GEDCOMPersonalName srcName in sourceRec.fPersonalNames)
            {
                GEDCOMPersonalName copyName = (GEDCOMPersonalName)GEDCOMPersonalName.Create(Owner, this, "", "");
                copyName.Assign(srcName);
                AddPersonalName(copyName);
            }
        }
コード例 #30
0
        private string GetComparableName(bool onlyFirstPart)
        {
            string resName;

            if (fPersonalNames.Count > 0)
            {
                GEDCOMPersonalName np = fPersonalNames[0];

                if (onlyFirstPart)
                {
                    resName = np.FirstPart;
                }
                else
                {
                    resName = np.StringValue;
                }
            }
            else
            {
                resName = "";
            }

            return(resName);
        }