示例#1
0
        static void Main(string[] args)
        {
            var dog = new Dog();
            var responses = dog.Bark(0);

            foreach (var response in responses)
            {
                Console.WriteLine(response);
            }
        }
示例#2
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            if (radDog.Checked == true)
            {
                Dog doggo1 = new Dog();

                doggo1.name   = Interaction.InputBox("Enter your dog's name");
                doggo1.color  = Interaction.InputBox("Enter your dog's color");
                doggo1.weight = Convert.ToDouble(Interaction.InputBox("Enter your dog's weight"));

                lblOutput.Text = doggo1.ToString();
                doggo1.Bark();
            }
            else if (radCat.Checked == true)
            {
                Cat cato1 = new Cat();

                cato1.name   = Interaction.InputBox("Enter your cat's name");
                cato1.color  = Interaction.InputBox("Enter your cat's color");
                cato1.weight = Convert.ToDouble(Interaction.InputBox("Enter your cat's weight"));

                lblOutput.Text = cato1.ToString();
                cato1.Meow();
            }
            else if (radBird.Checked == true)
            {
                Bird birb1 = new Bird();

                birb1.name   = Interaction.InputBox("Enter your bird's name");
                birb1.color  = Interaction.InputBox("Enter your bird's color");
                birb1.weight = Convert.ToDouble(Interaction.InputBox("Enter your bird's weight"));

                lblOutput.Text = birb1.ToString();
                birb1.Tweet();
            }
        }
 public void BarkOncePerTreat()
 {
     Dog dog = new Dog();
     var response = dog.Bark(12);
     Assert.AreEqual(12, response.Count);
 }
 public void NoBarkNoTreats()
 {
     Dog dog = new Dog();
     var response = dog.Bark(0);
     Assert.AreEqual(0, response.Count);
 }
 public void Bark()
 {
     Dog dog = new Dog();
     var response = dog.Bark(1);
     Assert.AreEqual(1, response.Count);
 }