Exemple #1
0
        public void GetFamilyByNameTest()
        {
            //Act
            List <Family> fam = _stats.GetFamilyByName("jim");

            Assert.IsTrue(fam[0].FamilyId == 1);
            fam = _stats.GetFamilyByName("Emma");
            Assert.IsTrue(fam[0].FamilyId == 2);
            fam = _stats.GetFamilyByName("Matthew");
            Assert.IsTrue(fam[0].FamilyId == 2);

            //Assert
        }
Exemple #2
0
        public void GetFamilyByNameTest()
        {
            //Arrange

            //Act
            List <Family> fam = stats.GetFamilyByName("jim");

            Assert.AreEqual(fam[0].FamilyId, 1);
            fam = stats.GetFamilyByName("Emma");
            Assert.AreEqual(fam[0].FamilyId, 2);
            fam = stats.GetFamilyByName("MATTHEW");
            Assert.AreEqual(fam[0].FamilyId, 2);

            //Assert
        }
Exemple #3
0
        static void Main(string[] args)
        {
            var context = new DataContext();

            #region
            // this code can be done in two ways, just in one line instead of two

            //var families = context.Families;
            // var myTest = new MyTester(families);
            #endregion

            var myTest = new MyTester(context.Families);

            // ------------- Calling Extension Methodts -------------------

            var myName = "Nelya";                     //  it's an extention
            Console.WriteLine(myName.SayHello());     // say hello extention method

            // Task: Create IsValidZipCode Extension Method

            string zip1    = "19115";
            string zipCode = zip1.IsValidZipCode1();
            Console.WriteLine(zip1.IsValidZipCode1());

            var zip = "12345";
            Console.WriteLine(zip.IsValidZipCode());



            // ----------- My Tester Methods Caling -----------

            Console.WriteLine("-----------Get Family With Most Kids-----------");
            List <Family> f = myTest.GetFamilyWithMostKids();
            PrintFamilies(f);

            Console.WriteLine("-----------Get Family With No Kids------------");
            f = myTest.GetFamilyWithNoKids();
            PrintFamilies(f);

            Console.WriteLine("-----------Get Family By Name ------------");
            f = myTest.GetFamilyByName("Jim");
            PrintFamilies(f);

            Console.WriteLine("--------All Father's Names and Ages-----------");
            foreach (var family in context.Families)
            {
                Console.WriteLine($"{family.Father.Name} - {family.Father.Age}");
            }

            Console.WriteLine("--------Average Age of Each Family -----------");
            foreach (var family in context.Families)
            {
                Console.WriteLine(family.FamilyId + " " + family.AverageAge);
            }

            Console.WriteLine("--------Get Youngest Family -----------");
            f = myTest.GetYoungestFamilyAge();
            PrintFamilies(f);

            // var youngestFamily = myTest.GetYoungestFamily();
            // Console.WriteLine(youngestFamily.Nickname);
            // Console.WriteLine(youngestFamily.FamilyId);
            //Console.WriteLine(youngestFamily.AverageAge);


            Console.WriteLine("--------Get Family With Youngest Child -----------");
            f = myTest.GetFamilyWithYoungestChild();
            PrintFamilies(f);

            Console.WriteLine("--------Get Family With Oldest Child-----------");
            //var oldestChild = myTest.GetFamilyWithOldestChild();
            //Console.WriteLine("Family  " + oldestChild.Nickname+ " " + oldestChild.FamilyId);
            //Console.WriteLine(" Age  " + oldestChild.OldestChildAge);

            f = myTest.GetFamilyWithOldestChild();
            PrintFamilies(f);

            Console.WriteLine("------Get Family With Parent Name Starts With (N)------");
            f = myTest.GetFamilyParentNameStartsWith("N");
            PrintFamilies(f);

            #region
            //var myTest = new MyTester();
            //myTest.Run();
            //foreach (var family in collection)
            //{

            //  }
            #endregion

            Console.ReadLine();
        }