예제 #1
0
        public void Skunk_Eats_Other()
        {
            Skunk eater = new Skunk();
            OtherEdibleCritters food = new OtherEdibleCritters();

            Assert.True(eater.Eat(food));
        }
예제 #2
0
    // Start is called on the frame when a script is enabled just before any of the Update methods are called the first time.
    private void Start()
    {
        rb = GetComponent <Rigidbody2D>();
        PlayerCharacter.PlayerCharacter pc = FindObjectOfType <PlayerCharacter.PlayerCharacter>();
        playerPosition = pc.transform.position;
        Skunk skunk = FindObjectOfType <Skunk>();

        skunkPosition = skunk.transform.position;
        Destroy(gameObject, 2.0f);
    }
예제 #3
0
        public void HonoursImplicitDefault()
        {
            // set-up

            Animal berty = new Dog("Berty");
            Animal henry = new Skunk("Henry");

            // test

            string text = PatternMatch(henry).Returns <string>()
                          .Case(berty, _ => "Berty")
                          .Case <Animal>(_ => _.Name == "Rover", _ => "rover")
                          .Case <Dog>(_ => "dog")
                          .Case <Cat>(_ => "cat");

            // validate

            Assert.IsNull(text);
        }
예제 #4
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();
        }
예제 #5
0
        public void Skunk_CanBeInstantiated()
        {
            Animal skunk = new Skunk();

            Assert.Equal("skunk", skunk.Species);
        }
예제 #6
0
        public void Skunk_Walks()
        {
            Mammal traveler = new Skunk();

            Assert.Equal("walk", traveler.Travel());
        }