示例#1
0
        public static void WaterAnimals()
        {
            Console.WriteLine("");
            Console.WriteLine("Dino-Shark I am!");
            DinoShark dinoShark = new DinoShark();

            Console.WriteLine($"Scales: {dinoShark.Scales}.");
            Console.WriteLine($"Packs: {dinoShark.Packs}.");
            Console.WriteLine($"Location: {dinoShark.Location}.");
            Console.WriteLine($"Eyes: {dinoShark.Eyes}.");
            Console.WriteLine($"Feeding Cost:${dinoShark.FeedCost}.");
            Console.WriteLine($"Are they safe: {dinoShark.Safe}.");
            Console.WriteLine($"Eat: {dinoShark.Eat()}.");
            Console.WriteLine($"How many eggs laid a year: {dinoShark.EggsPerYear()}.");


            Console.WriteLine("");
            Console.WriteLine("Octopus I am!");
            Octopus octopus = new Octopus();

            Console.WriteLine($"Scales: {octopus.Scales}.");
            Console.WriteLine($"Packs: {octopus.Packs}.");
            Console.WriteLine($"Location: {octopus.Location}.");
            Console.WriteLine($"Eyes: {octopus.Eyes}.");
            Console.WriteLine($"Feeding Cost:${octopus.FeedCost}.");
            Console.WriteLine($"Are they safe: {octopus.Safe}.");
            Console.WriteLine($"Eat: {octopus.Eat()}.");
            Console.WriteLine($"How many eggs laid a year: {octopus.EggsPerYear()}.");
            Console.WriteLine($"Smarts: {octopus.Smart()}.");

            Console.WriteLine("");
            Console.WriteLine("Orca I am!");
            Orca orca = new Orca();

            Console.WriteLine("");
            Console.WriteLine($"Tails: {orca.Tail}.");
            Console.WriteLine($"Packs: {orca.Packs}.");
            Console.WriteLine($"Location: {orca.Location}.");
            Console.WriteLine($"Eyes: {orca.Eyes}.");
            Console.WriteLine($"Feeding Cost:${orca.FeedCost}.");
            Console.WriteLine($"Are they safe: {orca.Safe}.");
            Console.WriteLine($"Eat: {orca.Eat()}.");
            Console.WriteLine($"How many does it give birth per year: {orca.GiveBirth()}.");

            //Interface here as Well
            Console.WriteLine("Dino-Otter I am!");
            DinoOtter dinoOtter = new DinoOtter();

            Console.WriteLine($"Tails: {dinoOtter.Tail}.");
            Console.WriteLine($"Packs: {dinoOtter.Packs}.");
            Console.WriteLine($"Location: {dinoOtter.Location}.");
            Console.WriteLine($"Eyes: {dinoOtter.Eyes}.");
            Console.WriteLine($"Feeding Cost:${dinoOtter.FeedCost}.");
            Console.WriteLine($"Are they safe: {dinoOtter.Safe}.");
            Console.WriteLine($"Eat: {dinoOtter.Eat()}.");
            Console.WriteLine($"How many does it give birth per year: {dinoOtter.GiveBirth()}.");
            Console.WriteLine($"Interface => Fun Tricks: {dinoOtter.FunTricks}.");
            Console.WriteLine($"Interface => Loves Humans: {dinoOtter.Splash()}.");
            Console.ReadLine();
        }
示例#2
0
        public void OrcaInterfaceMates()
        {
            ///Orac displaying appropriate interface behavior for IMate
            Orca orca = new Orca();

            Assert.True(orca.Reproducing());
        }
示例#3
0
        public void OrcaSwims()
        {
            /// Test that orca swimming exhibits proper behavior
            Orca orca = new Orca();

            Assert.True(orca.Swim());
        }
示例#4
0
        public void Orca_Eats_Dolphin()
        {
            Orca    eater = new Orca();
            Dolphin food  = new Dolphin();

            Assert.True(eater.Eat(food));
        }
示例#5
0
        public void Orca_Eats_Narwhal()
        {
            Orca    eater = new Orca();
            Narwhal food  = new Narwhal();

            Assert.True(eater.Eat(food));
        }
示例#6
0
        static void Orca()
        {
            Orca orca = new Orca();

            Console.WriteLine("Orca:");
            Console.WriteLine(orca.JumpRockBase());
        }
示例#7
0
        public void OrcaInterfaceHunts()
        {
            ///Orac displaying appropriate interface behavior for IHunt
            Orca orca = new Orca();

            Assert.True(orca.MadeKill());
        }
示例#8
0
        private void Generate_OnClick(object sender, RoutedEventArgs e)
        {
            Orca.Version version;
            switch (PbVersion.Text)
            {
            case "PB 11.5":
                version = Orca.Version.PB115;
                break;

            case "PB 12.5":
                version = Orca.Version.PB125;
                break;

            case "PB 12.6":
                version = Orca.Version.PB126;
                break;

            default:
                MessageBox.Show("Please select PB version!");
                return;
            }

            var orca = new Orca(version);

            orca.CreateDynamicLibrary(Path.Text, "");

            MessageBox.Show("Done!");
        }
示例#9
0
        public void OrcaEat()
        {
            /// Test that orca eating exhibits proper behavior
            Orca   orca       = new Orca();
            string testEating = "Me eat food.";

            Assert.Equal(testEating, orca.Eating());
        }
示例#10
0
        private void ReadCode()
        {
            Orca orca = new Orca(this.pbVersion);

            foreach (LibEntry entry in entries)
            {
                orca.FillCode(entry);
            }
        }
示例#11
0
        private void listWorkspace_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            if (e.NewValue is Library)
            {
                Library             lib       = (Library)e.NewValue;
                List <LibEntry>     libs      = new Orca(this.pbVersion).DirLibrary(lib.Dir + "\\" + lib.File);
                List <LibEntryView> libsViews = new List <LibEntryView>();

                foreach (LibEntry l in libs)
                {
                    libsViews.Add(new LibEntryView(l));
                }

                listPowerObjects.ItemsSource = libsViews;
            }
        }
示例#12
0
    private void SpawnRandomAnimalFriend()
    {
        Debug.Log("Spawn animal friend");
        var countOfAnimalFriendType = Enum.GetNames(typeof(AnimalFriendType)).Length;
        var randomAnimalFriend      = (AnimalFriendType)UnityEngine.Random.Range(0, countOfAnimalFriendType);

        switch (randomAnimalFriend)
        {
        case AnimalFriendType.Orca:
            Orca.SpawnAnimal();
            break;

        case AnimalFriendType.Pelican:
            Pelican.SpawnAnimal();
            break;
        }
    }
示例#13
0
        public void OrcaTest1()
        {
            Orca testOne = new Orca();

            Assert.True(testOne.Safe);
        }
示例#14
0
 /// <summary>
 /// constructor
 /// </summary>
 /// <param name="file">path to lib</param>
 /// <param name="version">PB version</param>
 public Library(string file, Orca.Version version)
 {
     this.orca = new Orca(version);
     dir       = file.Substring(0, file.LastIndexOf("\\"));
     this.file = file.Substring(file.LastIndexOf("\\") + 1);
 }
示例#15
0
        public void IsAnimal()
        {
            Orca testAnimal = new Orca();

            Assert.True(testAnimal is Animal);
        }
示例#16
0
        public void Orca_Swims()
        {
            Cetacean traveler = new Orca();

            Assert.Equal("swim", traveler.Travel());
        }
示例#17
0
        public void Orca_CanBeInstantiated()
        {
            Animal orca = new Orca();

            Assert.Equal("orca", orca.Species);
        }
示例#18
0
        static void Main(string[] args)
        {
            // make animals
            Skunk   skunk   = new Skunk();
            Weasel  weasel  = new Weasel();
            Bear    bear    = new Bear();
            Lion    lion    = new Lion();
            Wolf    wolf    = new Wolf();
            Narwhal narwhal = new Narwhal();
            Dolphin dolphin = new Dolphin();
            Orca    orca    = new Orca();

            // make dinner
            IAmDinner rat      = new OtherEdibleCritters();
            IAmDinner mole     = new OtherEdibleCritters();
            IAmDinner guppy    = new OtherEdibleCritters();
            IAmDinner salmon   = new OtherEdibleCritters();
            IAmDinner tuna     = new OtherEdibleCritters();
            IAmDinner sturgeon = new OtherEdibleCritters();
            IAmDinner bass     = new OtherEdibleCritters();

            // setting the stage
            Console.WriteLine("Chaos at the zoo!  All of the enclosures have been torn down by angry environmentalists, and the animals are out of control!");

            // skunk eats mole and births 3 babies
            Console.WriteLine("");
            skunk.Eat(mole);
            skunk.GiveBirth(3);

            // weasel eats rat and births 6 babies
            Console.WriteLine("");
            weasel.Eat(rat);
            weasel.GiveBirth(6);

            // lion and wolf each feast at the newly stocked weasel buffet
            Console.WriteLine("");
            lion.Eat(weasel);
            wolf.Eat(weasel);

            // wolf is expecting, so she also eats a bass
            Console.WriteLine("");
            wolf.Eat(bass);
            wolf.GiveBirth(3);

            // lion also had some buns in the oven
            Console.WriteLine("");
            lion.GiveBirth(4);

            // bear went out for dinner, and then went home to have babies and a nap
            Console.WriteLine("");
            bear.Travel();
            bear.Eat(salmon);
            bear.Travel();
            bear.GiveBirth(1);

            // meanwhile, in the water, everyone had babies!
            Console.WriteLine("");
            narwhal.GiveBirth(1);
            orca.GiveBirth(1);
            dolphin.GiveBirth(1);

            // ...and got hungry
            Console.WriteLine("");
            narwhal.Eat(guppy);
            dolphin.Eat(sturgeon);
            orca.Eat(narwhal);
            orca.Eat(dolphin);

            Console.ReadLine();
        }
示例#19
0
        public void OrcaTest2()
        {
            Orca testTwo = new Orca();

            Assert.Equal(2, testTwo.GiveBirth());
        }