public void HouseCatIsTypeAnimalAndFeline() { HouseCat sox = new HouseCat("Black&White", 10); Assert.IsAssignableFrom <Animal>(sox); Assert.IsAssignableFrom <Mammal>(sox); Assert.IsAssignableFrom <Feline>(sox); }
public void IsNotInitiallyTired() { keyboardCat = new HouseCat("Keyboard Cat"); Assert.IsFalse(keyboardCat.Hungry); Assert.IsFalse(keyboardCat.Tired); keyboardCat.Eat(); Assert.IsTrue(keyboardCat.Tired); }
void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.tag == "Player") { HouseCat player = other.gameObject.GetComponent <HouseCat>(); player.isNearPortal = true; player.nearestPortal = this; } }
void OnTriggerExit2D(Collider2D other) { if (other.gameObject.tag == "Player") { HouseCat player = other.gameObject.GetComponent <HouseCat>(); player.isNearPortal = false; player.nearestPortal = null; } }
public void HouseCatsFoodAcquisitionIsHumansTest() { // Arrange HouseCat houseCat = new HouseCat(); // Act string food = houseCat.FoodAquisition(); // Assert Assert.Equal("Humans", food); }
public void DerivedClassesHaveSoundFromAnimalAndIsOverriden() { HouseCat sox = new HouseCat("Black&White", 10); Sunfish sox2 = new Sunfish(); Snakes sox3 = new Snakes(false, true); Tiger socks = new Tiger(); Bird skcos = new Bird(); Frog frog = new Frog(); Assert.Equal("Meow meow", sox.Sound()); Assert.Equal("glug glug", sox2.Sound()); Assert.Equal("Croaaaak", frog.Sound()); Assert.Equal("hissssss", sox3.Sound()); Assert.Equal("Rawwwwr", socks.Sound()); Assert.Equal("Tweet tweet", skcos.Sound()); }
/// <summary> /// This just tests that the classes inherit properties /// </summary> static void Proof() { ChannelCatfish channelCatfish = new ChannelCatfish(); FlatheadCatfish flatheadCatfish = new FlatheadCatfish(); TigerShark tigerShark = new TigerShark(); GreatWhiteShark greatWhiteShark = new GreatWhiteShark(); EmperorPenguin emperorPenguin = new EmperorPenguin(); GalapagosPenguin galapagosPenguin = new GalapagosPenguin(); Mallard mallard = new Mallard(); MandarinDuck mandarinDuck = new MandarinDuck(); PrairieFalcon prairieFalcon = new PrairieFalcon(); Gyrfalcon gyrfalcon = new Gyrfalcon(); Dragon dragon = new Dragon(); KomodoDragon komodoDragon = new KomodoDragon(); Anaconda anaconda = new Anaconda(); Rattlesnake rattlesnake = new Rattlesnake(); Dhole dhole = new Dhole(); TundraWolf tundraWolf = new TundraWolf(); HouseCat houseCat = new HouseCat(); Jaguar jaguar = new Jaguar(); Console.WriteLine($"channel catfish gets food: {channelCatfish.FoodAquisition()}"); Console.WriteLine($"flathead catfish habitat: {flatheadCatfish.Habitat}"); Console.WriteLine($"great white shark cares for young?: {greatWhiteShark.CaresForYoung}"); Console.WriteLine($"tiger shark move: {tigerShark.FastestMovement()}"); Console.WriteLine($"emperor penguin swims?: {emperorPenguin.Sing()}"); Console.WriteLine($"galapagos penguin moves: {galapagosPenguin.FastestMovement()}"); Console.WriteLine($"mallard sound: {mallard.Sound()}"); Console.WriteLine($"mandarin duck does barrel roll?: {mandarinDuck.BarrelRoll()}"); Console.WriteLine($"gyrfalcon does barrel roll?: {gyrfalcon.BarrelRoll()}"); Console.WriteLine($"prairie falcon sound: {prairieFalcon.Sound()}"); Console.WriteLine($"dragon does barrel roll?: {dragon.BarrelRoll()}"); Console.WriteLine($"komodo dragon birth: {komodoDragon.Birth()}"); Console.WriteLine($" anaconda swims?: {anaconda.Sing()}"); Console.WriteLine($" rattlesnake gets food: {rattlesnake.FoodAquisition()}"); Console.WriteLine($"dhole gets food: {dhole.FoodAquisition()}"); Console.WriteLine($"dhole birth: {dhole.Birth()}"); Console.WriteLine($"tundra wolf move: {tundraWolf.FastestMovement()}"); Console.WriteLine($"house cat gets food: {houseCat.FoodAquisition()}"); Console.WriteLine($"jaguar can climb?: {jaguar.CanClimb}"); }
public void HouseCatLifeExpectancyTest() { HouseCat TestCat = new HouseCat(); Assert.InRange(TestCat.ExpectedLifeSpan(), 2, 16); }
public void InterfaceCatRatingTest() { HouseCat TestCat = new HouseCat(); Assert.Equal(9, TestCat.PetRating()); }
public void HouseCatFurTest() { HouseCat TestCat = new HouseCat(); Assert.Equal("Fur", TestCat.Coating); }
/// <summary> /// instatiates every derived class /// and displays all of its polymorphic properties and methods /// </summary> /// <param name="args"></param> public static void Main(string[] args) { Console.WriteLine("Hello World!"); //For Domesticated Dog Domesticated Fluffy = new Domesticated("Fluffy", 2); Domesticated Annie = new Domesticated("Annie", 5); Domesticated.WhatAnimal(); Console.WriteLine($"{Fluffy.Name} is {Fluffy.Age} years old"); Console.WriteLine($"{Fluffy.Name} is expected to live for {Fluffy.ExpectedLifeSpan()} years"); Console.WriteLine($"{Fluffy.Name} has {Fluffy.Coating}"); Console.WriteLine(Fluffy.MakeSound()); Fluffy.Action(); Fluffy.ThisAnimalSwims(); Fluffy.ThisAnimalCanBePet(); Fluffy.SwimSpeed(); Console.WriteLine(); //For different instatiating of Domesticated Console.WriteLine($"{Annie.Name} is {Annie.Age} years old"); Console.WriteLine($"{Annie.Name} is expected to live for {Annie.ExpectedLifeSpan()} years"); Console.WriteLine($"{Annie.Name} has {Annie.Coating}"); Console.WriteLine(Annie.MakeSound()); Annie.Action(); Console.WriteLine(); //For HouseCat Cat HouseCat Precious = new HouseCat("Precious", 7); HouseCat.WhatAnimal(); Console.WriteLine($"{Precious.Name} is {Precious.Age} years old"); Console.WriteLine($"{Precious.Name} has {Precious.Coating}"); Console.WriteLine($"{Precious.Name} is expected to live for {Precious.ExpectedLifeSpan()} years"); Console.WriteLine(Precious.MakeSound()); Precious.Action(); Precious.ThisAnimalCanBePet(); Console.WriteLine(); //For Japanese Puffer Japanese KnawKnaw = new Japanese("KnawKnaw", 5); Japanese.WhatAnimal(); Console.WriteLine($"{KnawKnaw.Name} is {KnawKnaw.Age} years old"); Console.WriteLine($"{KnawKnaw.Name} has {KnawKnaw.Coating}"); Console.WriteLine($"{KnawKnaw.Name} is expected to live for {KnawKnaw.ExpectedLifeSpan()} years"); Console.WriteLine(KnawKnaw.MakeSound()); Console.WriteLine(KnawKnaw.WillItPoisonYou(KnawKnaw.Poison)); KnawKnaw.SwimSpeed(); KnawKnaw.ThisAnimalSwims(); Console.WriteLine(); //For Brazilian Pirahna Brazilian CoCo = new Brazilian("CoCo", 4); Brazilian.WhatAnimal(); Console.WriteLine($"{CoCo.Name} is {CoCo.Age} years old"); Console.WriteLine($"{CoCo.Name} has {CoCo.Coating}"); Console.WriteLine($"{CoCo.Name} is expected to live for {CoCo.ExpectedLifeSpan()} years"); Console.WriteLine(CoCo.MakeSound()); Console.WriteLine(CoCo.WillItPoisonYou(CoCo.Poison)); CoCo.PetRating(); CoCo.ThisAnimalCanBePet(); CoCo.SwimSpeed(); CoCo.ThisAnimalSwims(); Console.WriteLine(); ////For African CrownEagle African America = new African("America", 8, 320); African.WhatAnimal(); Console.WriteLine($"{America.Name} is {America.Age} years old"); Console.WriteLine($"{America.Name} has {America.Coating}"); Console.WriteLine($"{America.Name} is expected to live for {America.ExpectedLifeSpan()} years"); Console.WriteLine($"{America.Name}'s top flight speed is {America.FlightSpeed}"); Console.WriteLine(America.MakeSound()); Console.WriteLine(); //For OldWorld Sparrow OldWorld Serene = new OldWorld("Sparrow", 8); OldWorld.WhatAnimal(); Console.WriteLine($"{Serene.Name} is {Serene.Age} years old"); Console.WriteLine($"{Serene.Name} has {Serene.Coating}"); Console.WriteLine($"{Serene.Name} is expected to live for {Serene.ExpectedLifeSpan()} years"); Console.WriteLine($"{Serene.Name}'s top flight speed is {Serene.FlightSpeed}"); Console.WriteLine(Serene.MakeSound()); Serene.PetRating(); Serene.ThisAnimalCanBePet(); Console.WriteLine(); Console.WriteLine(typeof(Japanese).GetInterface("ICanSwim")); Console.ReadKey(); }
public void InheritsDefaultCatInSecondConstructor() { keyboardCat = new HouseCat("Keyboard Cat"); Assert.AreEqual(13.0, keyboardCat.Weight, 0.001); }
public void CreateHouseCatObject() { keyboardCat = new HouseCat("Keyboard Cat", 7); }