コード例 #1
0
ファイル: UnitTest1.cs プロジェクト: Dervival/Lab0506-Zoo
        public void PidgeonInheritsLivesIn()
        {
            //LivesIn is in Bird
            Pidgeon testPidgeon = new Pidgeon();

            Assert.Equal("city", testPidgeon.LivesIn);
        }
コード例 #2
0
ファイル: UnitTest1.cs プロジェクト: Dervival/Lab0506-Zoo
        public void PidgeonCanCoo()
        {
            Pidgeon testPidgeon = new Pidgeon();
            string  testMessage = testPidgeon.Coo();

            Assert.Equal("The pidgeon goes 'Coo!'", testMessage);
        }
コード例 #3
0
ファイル: UnitTest1.cs プロジェクト: Dervival/Lab0506-Zoo
        public void PidgeonCanFlap()
        {
            Pidgeon testPidgeon = new Pidgeon();
            string  testMessage = testPidgeon.Flap();

            Assert.Equal("The pidgeon flutters its wings.", testMessage);
        }
コード例 #4
0
ファイル: UnitTest1.cs プロジェクト: Dervival/Lab0506-Zoo
        public void PidgeonCanEat()
        {
            Pidgeon testPidgeon = new Pidgeon();
            string  testMessage = testPidgeon.Eat();

            Assert.Equal("The Pidgeon is eating some birdseed.", testMessage);
        }
コード例 #5
0
ファイル: UnitTest1.cs プロジェクト: Dervival/Lab0506-Zoo
        public void EagleOverridesLivesIn()
        {
            //LivesIn is in Bird
            Bird  testBird  = new Pidgeon();
            Eagle testEagle = new Eagle();

            Assert.NotEqual(testEagle.LivesIn, testBird.LivesIn);
        }
コード例 #6
0
ファイル: UnitTest1.cs プロジェクト: Dervival/Lab0506-Zoo
        public void PidgeonInheritsWalk()
        {
            //Walk is in Bird, not Pidgeon
            Pidgeon testPidgeon = new Pidgeon();
            string  testMessage = testPidgeon.Walk();

            Assert.Equal("The Pidgeon walks around its nest in the city.", testMessage);
        }
コード例 #7
0
        public MainWindow()
        {
            var kot    = new Cat("Stefan", "black", 2, 5);
            var kot2   = new Cat("XD", "brown", 3, 6);
            var piesel = new Dog("PIESEL", "black", 10, 2);
            var golab  = new Pidgeon("golabek", 1, 1, "green");

            //    data.Animals[0] = kot;
            //    data.Animals[1] = kot2;
            //    data.Animals[2] = piesel;

            MyData.Animals.Add(kot);
            MyData.Animals.Add(kot2);
            MyData.Animals.Add(piesel);

            Animals = MyData.Animals;
            InitializeComponent();
            this.AnimalsDataGrid.ItemsSource = Animals;
        }
コード例 #8
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            Corgi   ein   = new Corgi();
            Samoyed sam   = new Samoyed();
            Pidgeon pete  = new Pidgeon();
            Eagle   ethan = new Eagle();
            Snake   sal   = new Snake();
            Dragon  dan   = new Dragon();

            Console.WriteLine("Meet Ein the " + ein.AnimalName + ".");
            ein.Eat();
            ein.Sleep();
            ein.Walk();
            ein.BrushSelf();
            ein.Bark();
            ein.Flop();
            Console.WriteLine("\nMeet Sam the " + sam.AnimalName + ".");
            sam.Eat();
            sam.Sleep();
            sam.Walk();
            sam.BrushSelf();
            sam.Bark();
            sam.SamoyedEat();
            sam.RollOver();
            Console.WriteLine("\nMeet Pete the " + pete.AnimalName + ".");
            pete.Eat();
            pete.Sleep();
            pete.Walk();
            pete.Flap();
            pete.TakeOff();
            pete.TakeOff();
            pete.Land("home");
            pete.Land("elseswhere");
            pete.Coo();
            Console.WriteLine("\nMeet Ethan the " + ethan.AnimalName + ".");
            ethan.Eat();
            ethan.Sleep();
            ethan.Walk();
            ethan.Flap();
            ethan.Hunt("snake");
            ethan.TakeOff();
            ethan.Land("the zoo");
            Console.WriteLine("\nMeet Sal the " + sal.AnimalName + ".");
            sal.StopHibernating();
            sal.Eat();
            sal.Sleep();
            sal.Walk();
            sal.Firebreath();
            sal.StartHibernating();
            sal.StopHibernating();
            Console.WriteLine("\nFinally, meet Dan the " + dan.AnimalName + ".");
            dan.Eat();
            dan.Sleep();
            dan.Walk();
            dan.Firebreath();
            dan.Fly();
            dan.TakeOff();
            dan.Land("your car");
            dan.StartHibernating();
            Console.WriteLine("\nThank you for visiting the zoo.");
        }