public void Test1() { IFactoryWithNotifier factory = new ConcreteFactory(); Subscribe subscribe = new Subscribe(); ObjectCreateHandler <IProduct> callback = new ObjectCreateHandler <IProduct>(subscribe.SetProduct); Assert.IsNull(subscribe.GetProduct()); factory.Create(callback); Assert.IsNotNull(subscribe.GetProduct()); }
public void Create(ObjectCreateHandler <IProduct> callback) { IProduct product = Create(); callback(product); }