Ejemplo n.º 1
0
        public void OneFromListComponent()
        {
            MainCage mc      = new MainCage();
            Animal   wolf    = new Wolf();
            Animal   bear    = new Bear();
            Animal   giraffe = new Giraffe();
            List <ICageComponent> components = new List <ICageComponent>();

            components.Add(wolf);
            components.Add(bear);
            components.Add(giraffe);

            int            number = 0;
            int            weight = 50;
            ICageComponent component;

            mc.AddAnimal(weight);
            component = mc.isOne(number);

            foreach (var expected in components)
            {
                if (expected.GetType() == component.GetType())
                {
                    Assert.AreEqual(expected.GetType(), component.GetType());
                }
            }
        }
Ejemplo n.º 2
0
        public void GetAnimalsForReading()
        {
            MainCage mc = new MainCage();
            List <ICageComponent> list;
            List <ICageComponent> expected = new List <ICageComponent>();

            list = mc.GetAnimals();

            Assert.AreEqual(expected.GetType(), list.GetType());
        }
Ejemplo n.º 3
0
        public void VoiceGiraffe()
        {
            MainCage mc = new MainCage();

            Animal giraffe  = new Giraffe();
            string expected = "It's a GIRAFFE!";

            string v = giraffe.Voice();

            Assert.AreEqual(expected, v);
        }
Ejemplo n.º 4
0
        public void VoiceWolf()
        {
            MainCage mc = new MainCage();

            Animal wolf     = new Wolf();
            string expected = "It's a WOLF WOLF WOLF ! ! !";

            string v = wolf.Voice();

            Assert.AreEqual(expected, v);
        }
Ejemplo n.º 5
0
        public void VoiceBear()
        {
            MainCage mc = new MainCage();

            Animal bear     = new Bear();
            string expected = "It's a BEAR!";

            string v = bear.Voice();

            Assert.AreEqual(expected, v);
        }
Ejemplo n.º 6
0
        public void AddNewCage()
        {
            MainCage mc     = new MainCage();
            int      number = 0;

            mc.AddCage(mc);

            ICageComponent expected  = mc;
            ICageComponent component = mc.isOne(number);

            Assert.AreEqual(expected.GetType(), component.GetType());
        }
Ejemplo n.º 7
0
        public void CageFromListComponent()
        {
            MainCage mc = new MainCage();
            List <ICageComponent> components = new List <ICageComponent>();

            components.Add(mc);

            int number = 0;

            mc.AddCage(mc);

            ICageComponent component = mc.isOne(number);
            ICageComponent expected  = components[number];

            Assert.AreEqual(expected.GetType(), component.GetType());
        }
Ejemplo n.º 8
0
        public void CheckParameterForDay()
        {
            MainCage mc       = new MainCage();
            bool     expected = true;
            string   time     = "day";

            mc.Day(time);

            Assert.AreEqual(expected, mc.isDay);

            expected = false;
            time     = "night";

            mc.Day(time);

            Assert.AreEqual(expected, mc.isDay);
        }
Ejemplo n.º 9
0
        public void AddAnimal()
        {
            MainCage mc = new MainCage();

            int weight = 10;
            int number = 0;

            Type[] expected = { typeof(Bear), typeof(Wolf), typeof(Giraffe) };

            mc.AddAnimal(weight);
            ICageComponent component = mc.isOne(number);

            foreach (var type in expected)
            {
                if (type == component.GetType())
                {
                    Assert.AreEqual(type, component.GetType());
                }
            }
        }