public void But_milking_animals_for_tests_is_wasteful() { var mockAnimal = new FakeAnimal(); var farm = new DairyFarm(mockAnimal); //We can test the farm machinery on a MOCK animal. // TODO Please remove the incorrect assertion. Assert.That(farm.GetProduce(), Is.EqualTo("Pretend milk")); Assert.That(farm.GetProduce(), Is.EqualTo("Real milk")); }
public void A_cow_farm_gives_us_cows_milk() { var cow = new Cow(); var farm = new DairyFarm(cow); //The farm is 'given' the animal to be milked // TODO Please remove the incorrect assertion. Assert.That(farm.GetProduce(), Is.EqualTo("Cow's milk")); Assert.That(farm.GetProduce(), Is.EqualTo("Pig's milk")); }
public void The_same_farm_can_give_us_goats_milk_too() { var goat = new Goat(); var farm = new DairyFarm(goat); //This is the essence of 'dependency injection' // TODO Please remove the incorrect assertion. Assert.That(farm.GetProduce(), Is.EqualTo("Cow's milk")); Assert.That(farm.GetProduce(), Is.EqualTo("Goat's milk")); }