コード例 #1
0
        public void FindFindAllTest01()
        {
            // create new list of names
            LIST <EN> names = LIST <EN> .CreateList(
                new EN(EntityNameUse.Legal, new ENXP[] {
                new ENXP("John", EntityNamePartType.Given),
                new ENXP("Smith", EntityNamePartType.Family)
            }),
                new EN(EntityNameUse.Legal, new ENXP[] {
                new ENXP("Jane", EntityNamePartType.Given),
                new ENXP("Smith", EntityNamePartType.Family)
            }),
                new EN(EntityNameUse.Legal, new ENXP[] {
                new ENXP("Melany", EntityNamePartType.Given),
                new ENXP("Smith", EntityNamePartType.Family)
            }),
                new EN(EntityNameUse.Legal, new ENXP[] {
                new ENXP("Sue", EntityNamePartType.Given),
                new ENXP("Ellen", EntityNamePartType.Family)
            })
                );

            // Finds all the legal names
            var dispNames = names.Find(en => en.Use.Contains(EntityNameUse.Legal));

            Console.WriteLine(dispNames + "\n");

            // Finds all names with a family name of Smith
            var dispAllNames = names.FindAll(en => en.Part.Exists(part => part.Value == "Smith"));

            foreach (var item in dispAllNames)
            {
                Console.WriteLine(item.ToString());
            }

            names.NullFlavor = null;
            Assert.IsTrue(names.Validate());
        }