public void OneFromListComponent() { MainCage mc = new MainCage(); Animal wolf = new Wolf(); Animal bear = new Bear(); Animal giraffe = new Giraffe(); List <ICageComponent> components = new List <ICageComponent>(); components.Add(wolf); components.Add(bear); components.Add(giraffe); int number = 0; int weight = 50; ICageComponent component; mc.AddAnimal(weight); component = mc.isOne(number); foreach (var expected in components) { if (expected.GetType() == component.GetType()) { Assert.AreEqual(expected.GetType(), component.GetType()); } } }
public void AddAnimal() { MainCage mc = new MainCage(); int weight = 10; int number = 0; Type[] expected = { typeof(Bear), typeof(Wolf), typeof(Giraffe) }; mc.AddAnimal(weight); ICageComponent component = mc.isOne(number); foreach (var type in expected) { if (type == component.GetType()) { Assert.AreEqual(type, component.GetType()); } } }