예제 #1
0
        public void Display()
        {
            Duck   duck = new Duck("Утьоночек", 3, 5, true);
            string str  = duck.Display();

            Assert.Equal("Уточки - милые создания", str);
        }
예제 #2
0
        private static void PerformDuckFunctions(Duck duck)
        {
            duck.Display();
            duck.PerformQuack();
            duck.PerformSwim();
            duck.PerformFly();

            Console.WriteLine();
        }
예제 #3
0
        public void Display_GivesString()
        {
            IFlyStrategy   f = new Flap();
            IQuackStrategy q = new OneBigQuack();

            Duck d      = new Duck(f, q);
            var  actual = d.Display();

            Assert.IsType <String>(actual);
        }
예제 #4
0
        public void Duck_IsModular()
        {
            string         expected = "Glide quackquackquack";
            IFlyStrategy   f        = new Glide();
            IQuackStrategy q        = new ManyTinyQuacks();

            Duck   d      = new Duck(f, q);
            string actual = d.Display();

            Assert.Equal(expected, actual);
        }
예제 #5
0
        public void Duck_Composes()
        {
            string         expected = "Flap Quack";
            IFlyStrategy   f        = new TestFlyStrategy();
            IQuackStrategy q        = new TestQuackStrategy();

            Duck   d      = new Duck(f, q);
            string actual = d.Display();

            Assert.Equal(expected, actual);
        }
예제 #6
0
파일: Program.cs 프로젝트: egoshin-igor/OOD
        private static void SimulateDuck(Duck duck)
        {
            if (duck == null)
            {
                return;
            }

            Console.WriteLine(duck.GetType().Name);
            duck.Dance();
            duck.Display();
            duck.Fly();
            duck.Quack();
            duck.Swim();
            Console.WriteLine();
        }
예제 #7
0
        static void PerformActions(Duck duck)
        {
            Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
            Console.WriteLine("Type to make duck  perform some action:");
            Console.WriteLine("1 for display");
            Console.WriteLine("2 for make it fly");
            Console.WriteLine("3 for make it Swim");
            Console.WriteLine("4 for make it Quack");
            Console.WriteLine("0 to go Back");
            while (true)
            {
                int.TryParse(Console.ReadLine(), out int perform);
                switch (perform)
                {
                case 0:
                    RunDuckApp();
                    return;

                case 1:
                    duck.Display();
                    break;

                case 2:
                    duck.performFly();
                    break;

                case 3:
                    duck.Swim();
                    break;

                case 4:
                    duck.performQuack();
                    break;

                default:
                    break;
                }
            }
        }
예제 #8
0
 public void Display()
 {
     Assert.AreEqual(DuckMessages.ModelDisplay, duck.Display());
 }
예제 #9
0
 static void DrawDuck(Duck duck)
 {
     duck.Display();
 }
 private static void TestDuck(Duck duck)
 {
     duck.Display();
     duck.Quack();
     duck.Fly();
 }
예제 #11
0
 public void Display()
 {
     Assert.AreEqual(DuckMessages.RubberDisplay, duck.Display());
 }
예제 #12
0
 private void btnDisplay_Click(object sender, EventArgs e)
 {
     CheckDuckType();
     lblMessage.Text = _duck.Display();
 }
예제 #13
0
 static void PrintMsg(Duck duck)
 {
     sb.Append(duck.Display());
     sb.Append(duck.PerformFly());
     sb.Append(duck.PerformQuack());
 }
예제 #14
0
 private void btnDisplay_Click(object sender, EventArgs e)
 {
     lblDisplay.Text = _duck.Display();
 }
예제 #15
0
파일: Form1.cs 프로젝트: Levimps/t6
 private void Display_Click(object sender, EventArgs e)
 {
     CheckDuckType();
     lblDisplay.Text = _duck.Display();
 }