Exemplo n.º 1
0
        public void Test()
        {
            Vasya  vasyok = new Vasya();
            Friend fr1    = new Friend();
            Friend fr2    = new Friend();
            Friend fr3    = new Friend();

            vasyok.apples = 27;
            vasyok.VasyaEat(3);
            Console.WriteLine(vasyok.apples);
            //vasyok.apples = vasyok.apples - 3;

            double applesForEachFriend = new CalcCore().DivideMethod(vasyok.apples, 3);

            fr1.Eat(applesForEachFriend);
            fr2.Eat(applesForEachFriend);
            fr3.Eat(applesForEachFriend);

            double eatenApples = new CalcCore().PlusMethod(fr1.hasEat, fr2.hasEat);

            Console.WriteLine(eatenApples);
            eatenApples = new CalcCore().PlusMethod(eatenApples, fr3.hasEat);


            vasyok.apples = new CalcCore().MinusMethod(vasyok.apples, eatenApples);
            double er = 0;

            Assert.AreEqual(er, vasyok.apples);
        }
Exemplo n.º 2
0
        public void TestDrink_1()
        {
            Vasya vasyok = new Vasya();

            vasyok.amountOfLitersWater = 100;
            List <Friend> friendList = new List <Friend>();

            for (int i = 0; i < amountOfFriends; i++)
            {
                friendList.Add(new Friend()
                {
                    _name = "Friend_" + (i + 1)
                });
                Console.WriteLine(friendList[i]._name);
            }

            double totalDrunked = 0;

            for (int i = 0; i < amountOfDay; i++)
            {
                vasyok.VasyaDrink(3);
                for (int j = 0; j < friendList.Count; j++)
                {
                    friendList[j].Drink(4);
                    totalDrunked += 4;
                }
            }
            double litersLeft       = vasyok.amountOfLitersWater - totalDrunked;
            double _expected_result = -33;

            Assert.AreEqual(_expected_result, litersLeft);
        }
Exemplo n.º 3
0
 public void KillAll()
 {
     vasyok = null;
     fr1    = null;
     fr2    = null;
     fr3    = null;
     fr4    = null;
 }
Exemplo n.º 4
0
        public void VasyaVSFriendsEatDrink()
        {
            Vasya  vasyok = new Vasya();
            Friend fr1    = new Friend();
            Friend fr2    = new Friend();
            Friend fr3    = new Friend();
            Friend fr4    = new Friend();

            vasyok.apples = 27;
            vasyok.water  = 100;

            for (int i = 0; i < 7; i++)
            {
                vasyok.VasyaEat(3);
            }

            double applesForFriends = vasyok.apples;

            applesForFriends = new CalcCore().DivideMethod(applesForFriends, 4);

            double friendsDrinkWater = 0;

            for (int i = 0; i < 7; i++)
            {
                vasyok.VasyaDrink(3);
                fr1.Drink(4);
                friendsDrinkWater += 4;
                fr2.Drink(4);
                friendsDrinkWater += 4;
                fr3.Drink(4);
                friendsDrinkWater += 4;
                fr4.Drink(4);
                friendsDrinkWater += 4;
            }

            double friendsEatApples = 0;

            fr1.Eat(applesForFriends);
            friendsEatApples += applesForFriends;
            fr2.Eat(applesForFriends);
            friendsEatApples += applesForFriends;
            fr3.Eat(applesForFriends);
            friendsEatApples += applesForFriends;
            fr4.Eat(applesForFriends);
            friendsEatApples += applesForFriends;

            vasyok.apples -= friendsEatApples;
            vasyok.water  -= friendsDrinkWater;

            Assert.AreEqual(0, vasyok.apples);
            Assert.AreEqual(-33, vasyok.water);
        }
Exemplo n.º 5
0
        public void TestDrink_2()
        {
            Vasya vasyok = new Vasya();

            vasyok.apples = 27;
            vasyok.amountOfLitersWater = 100;
            for (int i = 0; i < amountOfDay; i++)
            {
                vasyok.VasyaEat(3);
                vasyok.VasyaDrink(3);
            }
            double _expected_result_Apples = 6;
            double _expected_result_Water  = 79;

            Assert.AreEqual(_expected_result_Apples, vasyok.apples);
            Assert.AreEqual(_expected_result_Water, vasyok.amountOfLitersWater);
        }
Exemplo n.º 6
0
        public void SetUpTestData()
        {
            vasyok = new Vasya();
            fr1    = new Friend();
            fr2    = new Friend();
            fr3    = new Friend();
            fr4    = new Friend();

            /*
             * ArrayList friends = new ArrayList();
             * for (int i = 0; i < friendsAmount; i++)
             * {
             *  friends.Add(new Friend());
             * }
             * Console.WriteLine(friends.Count);
             */
        }
Exemplo n.º 7
0
        public void TestDrink_3()
        {
            Vasya         vasyok     = new Vasya();
            List <Friend> friendList = new List <Friend>();

            for (int i = 0; i < amountOfFriends; i++)
            {
                friendList.Add(new Friend()
                {
                    _name = "Friend_" + (i + 1)
                });
                Console.WriteLine(friendList[i]._name);
            }
            vasyok.apples = 27;
            vasyok.amountOfLitersWater = 100;
            double totalDrunked = 0;

            for (int i = 0; i < amountOfDay; i++)
            {
                vasyok.VasyaEat(3);
                vasyok.VasyaDrink(3);
                for (int j = 0; j < friendList.Count; j++)
                {
                    friendList[j].Drink(4);
                    totalDrunked += 4;
                }
            }
            vasyok.amountOfLitersWater -= totalDrunked;

            double applesForEachFriend = new CalcCore().DivideMethod(vasyok.apples, amountOfFriends);
            double eatenApples         = 0;

            for (int i = 0; i < amountOfFriends; i++)
            {
                friendList[i].Eat(applesForEachFriend);
                eatenApples += friendList[i].hasEat;
            }
            vasyok.apples -= eatenApples;

            double _expected_result_Water  = -33;
            double _expected_result_Apples = 0;

            Assert.AreEqual(_expected_result_Water, vasyok.amountOfLitersWater);
            Assert.AreEqual(_expected_result_Apples, vasyok.apples);
        }
Exemplo n.º 8
0
        public void VasyaEatDrink()
        {
            Vasya vasyok = new Vasya();

            vasyok.apples = 27;
            vasyok.water  = 100;

            for (int i = 0; i < 7; i++)
            {
                vasyok.VasyaEat(3);
                vasyok.VasyaDrink(3);
            }

            double expect_apples = 6;
            double expect_waters = 79;

            Assert.AreEqual(expect_apples, vasyok.apples);
            Assert.AreEqual(expect_waters, vasyok.water);
        }
Exemplo n.º 9
0
        public void Test()
        {
            Vasya         vasyok     = new Vasya();
            List <Friend> friendList = new List <Friend>();

            for (int i = 0; i < amountOfFriends; i++)
            {
                friendList.Add(new Friend()
                {
                    _name = "Friend_" + (i + 1)
                });
                Console.WriteLine(friendList[i]._name);
            }

            vasyok.apples = 27;
            vasyok.VasyaEat(3);
            double applesForEachFriend = new CalcCore().DivideMethod(vasyok.apples, amountOfFriends);

            for (int i = 0; i < amountOfFriends; i++)
            {
                friendList[i].Eat(applesForEachFriend);
            }

            double eatenApples = 0;

            for (int i = 0; i < amountOfFriends; i++)
            {
                eatenApples = new CalcCore().PlusMethod(eatenApples, friendList[i].hasEat);
            }
            Console.WriteLine(eatenApples);

            vasyok.apples = new CalcCore().MinusMethod(vasyok.apples, eatenApples);
            double _expected_result = 0;

            Assert.AreEqual(_expected_result, vasyok.apples);
        }
Exemplo n.º 10
0
        public void GivenVasyaHaveLitersOfWater(int p0)
        {
            Vasya vasyok = new Vasya();

            vasyok.water = 100;
        }