示例#1
0
        public void TestNameSearch()
        {
            YHaplo[] haplos = new YHaplo[6];
            haplos[0] = new YHaplo(new string[] { "A", "B", "C" });
            haplos[1] = new YHaplo(new string[] { "D", "E", "F" });
            haplos[2] = new YHaplo(new string[] { "G", "H", "I" });
            haplos[3] = new YHaplo(new string[] { "J", "K", "L" });
            haplos[4] = new YHaplo(new string[] { "M", "N", "O" });
            haplos[5] = new YHaplo(new string[] { "P", "Q", "R" });

            Assert.IsNotNull(YHaplo.SearchForNameInHaplogroups(haplos, "A"));
            Assert.IsNotNull(YHaplo.SearchForNameInHaplogroups(haplos, "E"));
            Assert.IsNotNull(YHaplo.SearchForNameInHaplogroups(haplos, "I"));
            Assert.IsNotNull(YHaplo.SearchForNameInHaplogroups(haplos, "Q"));
            Assert.IsNotNull(YHaplo.SearchForNameInHaplogroups(haplos, "R"));
            Assert.IsNull(YHaplo.SearchForNameInHaplogroups(haplos, "Z"));
            Assert.IsNull(YHaplo.SearchForNameInHaplogroups(haplos, "4"));
            Assert.IsNull(YHaplo.SearchForNameInHaplogroups(haplos, "A1"));
            Assert.IsNull(YHaplo.SearchForNameInHaplogroups(haplos, "R2"));

            Assert.AreEqual(YHaplo.SearchForNameInHaplogroups(haplos, "I").PrimaryName, YHaplo.SearchForNameInHaplogroups(haplos, "H").PrimaryName);

            Assert.IsTrue(YHaplo.SearchForNameInHaplogroups(haplos, "I").Names.Contains("G"));
            Assert.IsTrue(YHaplo.SearchForNameInHaplogroups(haplos, "I").Names.Contains("H"));
            Assert.IsTrue(YHaplo.SearchForNameInHaplogroups(haplos, "I").Names.Contains("I"));

            Assert.IsTrue(YHaplo.SearchForNameInHaplogroups(haplos, "P").Names.Contains("Q"));

            Assert.IsFalse(YHaplo.SearchForNameInHaplogroups(haplos, "P").Names.Contains("A"));
        }
示例#2
0
        public void TestPrimaryName()
        {
            YHaplo[] haplos = new YHaplo[6];
            haplos[0] = new YHaplo(new string[] { "A", "B", "C" });
            haplos[1] = new YHaplo(new string[] { "D", "E", "F" });
            haplos[2] = new YHaplo(new string[] { "G", "H", "I" });
            haplos[3] = new YHaplo(new string[] { "J", "K", "L" });
            haplos[4] = new YHaplo(new string[] { "M", "N", "O" });
            haplos[5] = new YHaplo(new string[] { "P", "Q", "R" });

            Assert.AreEqual(YHaplo.SearchForNameInHaplogroups(haplos, "Q").PrimaryName, "P");
            Assert.AreEqual(YHaplo.SearchForNameInHaplogroups(haplos, "A").PrimaryName, YHaplo.SearchForNameInHaplogroups(haplos, "C").PrimaryName);
            Assert.AreEqual(YHaplo.SearchForNameInHaplogroups(haplos, "I").PrimaryName, YHaplo.SearchForNameInHaplogroups(haplos, "H").PrimaryName);
        }
示例#3
0
        public void TestPopulateNonBinaryChildrenWithDummies()
        {
            YHaplo[] haplos = new YHaplo[6];
            haplos[0] = new YHaplo(new string[] { "A", "B", "C" });
            haplos[1] = new YHaplo(new string[] { "D", "E", "F" });
            haplos[2] = new YHaplo(new string[] { "G", "H", "I" });
            haplos[3] = new YHaplo(new string[] { "J", "K", "L" });
            haplos[4] = new YHaplo(new string[] { "M", "N", "O" });
            haplos[5] = new YHaplo(new string[] { "P", "Q", "R" });
            YHaplo root = new YHaplo(new string[] { "1", "01", "001" });

            root.PopulateNonBinaryChildrenWithDummies(haplos);
            //Check for all the children.
            Assert.IsNotNull(YHaplo.SearchForNameInHaplogroups(haplos, "A"));
            Assert.IsNotNull(YHaplo.SearchForNameInHaplogroups(haplos, "B"));
            Assert.IsNotNull(YHaplo.SearchForNameInHaplogroups(haplos, "D"));
            Assert.IsNotNull(YHaplo.SearchForNameInHaplogroups(haplos, "G"));
            Assert.IsNotNull(YHaplo.SearchForNameInHaplogroups(haplos, "J"));
            Assert.IsNotNull(YHaplo.SearchForNameInHaplogroups(haplos, "M"));
            Assert.IsNotNull(YHaplo.SearchForNameInHaplogroups(haplos, "P"));
            Assert.IsNull(YHaplo.SearchForNameInHaplogroups(haplos, "5"));
        }