public void CheckIfFactoryPreparesGivenFoodTypeTest() { PastaFactoryWithReflection factory = PastaFactoryWithReflection.Instance; factory.Register("vegePasta", typeof(PestoSpaghetti)); factory.Register("meatPasta", typeof(BologneseSpaghetti)); var vege = factory.PreparePasta("vegePasta"); var meat = factory.PreparePasta("meatPasta"); Assert.That(vege, Is.InstanceOf <PestoSpaghetti>()); Assert.That(meat, Is.InstanceOf <BologneseSpaghetti>()); }
public void Setup() { this.simpleFactory = ChefMariano.Instance; this.coffeeFM = CoffeeFactory.Instance; this.pizzaFM = VegePizzaFactory.Instance; this.withRegistration = PizzaFactoryWithRegistration.Instance; withRegistration.Register("meat", () => new Capriciosa()); withRegistration.Register("vege", () => new Margherita()); this.withReflection = PastaFactoryWithReflection.Instance; withReflection.Register("meatDish", typeof(BologneseSpaghetti)); withReflection.Register("vegeDish", typeof(PestoSpaghetti)); }
public void TearDown() { this.withReflection = null; this.withRegistration = null; }