Ejemplo n.º 1
0
        private static void GetRelation(List <string> values)
        {
            IEnumerable <PersonDTO> response = new List <PersonDTO>();

            try
            {
                switch (values[2])
                {
                case "Paternal-Uncle":
                    response = relations.PaternalUncle(values[1]);
                    break;

                case "Maternal-Uncle":
                    response = relations.MaternalUncle(values[1]);
                    break;

                case "Paternal-Aunt":
                    response = relations.PaternalAunt(values[1]);
                    break;

                case "Maternal-Aunt":
                    response = relations.MaternalAunt(values[1]);
                    break;

                case "Brother-In-Law":
                    response = relations.BrotherInLaw(values[1]);
                    break;

                case "Sister-In-Law":
                    response = relations.SisterInLaw(values[1]);
                    break;

                case "Son":
                    response = relations.Son(values[1]);
                    break;

                case "Daughter":
                    response = relations.Daughter(values[1]);
                    break;

                case "Siblings":
                    response = relations.Siblings(values[1]);
                    break;
                }
            }
            catch (ArgumentException)
            {
                Console.WriteLine("PERSON_NOT_FOUND");
                throw;
            }

            var    names         = response.Select(m => m.Name);
            string namesAsString = names.Count() == 0 ? "NONE" : string.Join(" ", names);

            //Console.WriteLine($" {namesAsString}");
            Console.WriteLine($"{namesAsString}");
        }
Ejemplo n.º 2
0
        public void DaughterTest1()
        {
            var GeorgeSons = relationships.Daughter("George");
            var expected   = new List <PersonDTO>()
            {
                sally
            };

            GeorgeSons.Should().BeEquivalentTo(expected, m => m.WithStrictOrdering());
        }