コード例 #1
0
        private string GetFamilyString()
        {
            string result = "";

            GEDCOMIndividualRecord spouse = GetHusband();

            result += (spouse == null) ? "?" : spouse.GetPrimaryFullName();
            result += " - ";
            spouse  = GetWife();
            result += (spouse == null) ? "?" : spouse.GetPrimaryFullName();

            return(result);
        }
コード例 #2
0
        public void Test_Names_01()
        {
            using (BaseContext ctx = new BaseContext(null)) {
                Assembly assembly = typeof(CoreTests).Assembly;
                using (Stream stmGed1 = assembly.GetManifestResourceStream("GKTests.Resources.test_names_01.ged")) {
                    var gedcomProvider = new GEDCOMProvider(ctx.Tree);
                    gedcomProvider.LoadFromStreamExt(stmGed1, stmGed1);

                    GEDCOMIndividualRecord iRec1 = ctx.Tree.XRefIndex_Find("I1") as GEDCOMIndividualRecord;
                    Assert.IsNotNull(iRec1);
                    Assert.AreEqual("Александра Анатольевна Лазорева (Иванова)", iRec1.GetPrimaryFullName());
                    // std-surn exists and double, but sub-surn has only second part
                    // sub-givn exists, but sub-patn is not
                    var parts = GKUtils.GetNameParts(iRec1);
                    Assert.AreEqual("Иванова", parts.Surname);
                    Assert.AreEqual("Александра", parts.Name);
                    Assert.AreEqual("Анатольевна", parts.Patronymic);

                    GEDCOMIndividualRecord iRec2 = ctx.Tree.XRefIndex_Find("I2") as GEDCOMIndividualRecord;
                    Assert.IsNotNull(iRec2);
                    Assert.AreEqual("Петр Константинович Лазорев", iRec2.GetPrimaryFullName());
                    // std-surn exists, but sub-surn is not
                    // sub-givn exists, but sub-patn is not
                    parts = GKUtils.GetNameParts(iRec2);
                    Assert.AreEqual("Лазорев", parts.Surname);
                    Assert.AreEqual("Петр", parts.Name);
                    Assert.AreEqual("Константинович", parts.Patronymic);
                }
            }
        }
コード例 #3
0
        public void Test_Names_02()
        {
            using (BaseContext ctx = new BaseContext(null)) {
                Assembly assembly = typeof(CoreTests).Assembly;
                using (Stream stmGed1 = assembly.GetManifestResourceStream("GKTests.Resources.test_names_02.ged")) {
                    var gedcomProvider = new GEDCOMProvider(ctx.Tree);
                    gedcomProvider.LoadFromStreamExt(stmGed1, stmGed1);

                    GEDCOMIndividualRecord iRec1 = ctx.Tree.XRefIndex_Find("I1") as GEDCOMIndividualRecord;
                    Assert.IsNotNull(iRec1);
                    Assert.AreEqual("Анна Сидоровна Иванова (Петрова)", iRec1.GetPrimaryFullName());
                    // std-surn exists and double, and sub-surn same
                    // sub-givn and sub-patn exists
                    var parts = GKUtils.GetNameParts(iRec1);
                    Assert.AreEqual("Иванова (Петрова)", parts.Surname);
                    Assert.AreEqual("Анна", parts.Name);
                    Assert.AreEqual("Сидоровна", parts.Patronymic);

                    GEDCOMIndividualRecord iRec2 = ctx.Tree.XRefIndex_Find("I2") as GEDCOMIndividualRecord;
                    Assert.IsNotNull(iRec2);
                    Assert.AreEqual("Аглая Федоровна Иванова", iRec2.GetPrimaryFullName());
                    // std-surn exists (maiden), and sub-surn same, and sub-marn exists (married)
                    // sub-givn and sub-patn exists
                    parts = GKUtils.GetNameParts(iRec2);
                    Assert.AreEqual("Иванова", parts.Surname);
                    Assert.AreEqual("Лескова", parts.MarriedSurname);
                    Assert.AreEqual("Аглая", parts.Name);
                    Assert.AreEqual("Федоровна", parts.Patronymic);
                }
            }
        }
コード例 #4
0
        public void Test_FTB6_ANSI_Win1251()
        {
            using (BaseContext ctx = new BaseContext(null)) {
                Assembly assembly = typeof(CoreTests).Assembly;
                using (Stream stmGed1 = assembly.GetManifestResourceStream("GKTests.Resources.test_ftb6_ansi(win1251).ged")) {
                    var gedcomProvider = new GEDCOMProvider(ctx.Tree);
                    gedcomProvider.LoadFromStreamExt(stmGed1, stmGed1);

                    GEDCOMIndividualRecord iRec1 = ctx.Tree.XRefIndex_Find("I1") as GEDCOMIndividualRecord;
                    Assert.IsNotNull(iRec1);

                    Assert.AreEqual("Иван Васильевич Петров", iRec1.GetPrimaryFullName());
                }
            }
        }