Exemplo n.º 1
0
        public void InitPeople_AgeBetween0And99()
        {
            //Arrange

            //Act
            var persons = PeopleManipulation.InitPeople(new RealPersonFactory());

            //Assert
            Assert.AreEqual(persons.Count(p => p.Age > 0 && p.Age < 100), 10000);
        }
Exemplo n.º 2
0
        public void InitPeople_NameStartsWithPerson()
        {
            //Arrange

            //Act
            var persons = PeopleManipulation.InitPeople(new RealPersonFactory());

            //Assert
            Assert.AreEqual(persons.Count(p => p.Name.StartsWith("Person ")), 10000);
        }
Exemplo n.º 3
0
        public void InitPeople_10000()
        {
            //Arrange

            //Act
            var Result = PeopleManipulation.InitPeople(new RealPersonFactory());

            //Assert
            Assert.AreEqual(Result.Count, 10000);
        }
Exemplo n.º 4
0
        public void InitPeople_NoEmptyRaces()
        {
            //Arrange

            //Act
            var persons = PeopleManipulation.InitPeople(new RealPersonFactory());

            //Assert
            //No empty races allowed
            Assert.AreEqual(true, persons.Count(p => p.Race == null) == 0);
        }
Exemplo n.º 5
0
        public void AddYearsToEveryonesAgeTest()
        {
            var People  = PeopleManipulation.InitPeople(new RealPersonFactory());
            int oldAges = People.Sum(p => p.Age);
            int newAges;

            PeopleManipulation.AddYearsToEveryonesAge(People, 1);

            newAges = People.Sum(p => p.Age);

            // added 1 year to all people
            Assert.AreEqual(People.Count, newAges - oldAges);
        }
Exemplo n.º 6
0
        public void InitPeople_AllRacesRepresented()
        {
            //Arrange

            //Act
            var persons = PeopleManipulation.InitPeople(new RealPersonFactory());

            //Assert
            Assert.AreEqual(true, persons.Count(p => p.Race == "Angle") > 0, "No Angles found");
            Assert.AreEqual(true, persons.Count(p => p.Race == "Saxon") > 0, "No Saxons found");
            Assert.AreEqual(true, persons.Count(p => p.Race == "Jute") > 0, "No Jutes found");
            Assert.AreEqual(true, persons.Count(p => p.Race == "Asian") > 0, "No Asians found");
        }