public void Should_Get_The_Right_Card_Controller_By_Type() { ICreator instance = new ConcreteCreator(); instance.FactoryMethod(Manufacturer.Card); var creator = instance.FactoryMethod(Manufacturer.Card); var expectedValue = "Door opened by Card"; Assert.AreEqual(expectedValue, creator.OpenDoor()); }
public void Should_Return_The_Right_Biometric_Instance() { ICreator instance = new ConcreteCreator(); instance.FactoryMethod(Manufacturer.Biometric); var expectedType = "BiometricController"; var type = instance.FactoryMethod(Manufacturer.Biometric).GetType().Name; Assert.AreEqual(expectedType, type); }
static void Main(string[] args) { Creator creator = new ConcreteCreator(); Product product = creator.FactoryMethod(); creator.Operation(); }
public override void Handle(Receiver receiver, SentMessage smMessage, SchoolStaff ss, string ssp, ApplicationDbContext context) { if (receiver.SentMessage == true) { try { if ((smMessage.TypeMessage == TypeMessage.Phone) && (ssp == string.Empty)) { receiver.WriteDb = false; } else { var cc = new ConcreteCreator(); var a = cc.FactoryMethod(smMessage); a.ConcreteMessage(ss, ssp); receiver.WriteDb = true; smMessage.Status = true; } } catch (Exception e) { smMessage.Status = false; Console.WriteLine(e); throw; } if (Successor != null) { Successor.Handle(receiver, smMessage, ss, ssp, context); } } }
private static void FactoryMethodExample() { var creator = new ConcreteCreator(); var product = creator.FactoryMethod(); Console.WriteLine($"Product Type: {product.GetType().Name}"); }
public void test() { IList<string> cabecera = new List<string>(); Creator aCreator = new ConcreteCreator(); ProductoExcel product = aCreator.FactoryMethod(ConcreteCreator.TipoExcel.XLS); //product.CargarDatos(cabecera); }
public static void Main() { var creator = new ConcreteCreator(); Product p; p = creator.FactoryMethod(-1); p.Show(); p = creator.FactoryMethod(1); p.Show(); p = creator.FactoryMethod(0); p.Show(); Console.ReadKey(); }
void foo() { Creator creator = null; Product product = null; creator = new ConcreteCreator(); product = creator.FactoryMethod(); creator.AnOperation(); }
static void Main(string[] args) { Product.Product product = null; var creator = new ConcreteCreator(); product = creator.FactoryMethod(); creator.AnOperation(); }
static void Main(string[] args) { Creator creator = new ConcreteCreator(); IProduct product = creator.FactoryMethod(); product.DoWork(); var twitter = new TwitterMessanger("admin", "admin"); var twit = twitter.CreateMessage("Hi, Bro!", "admin", "John Doe"); twit.Send(); var telegram = new TelegramMessanger("admin", "admin"); var text = telegram.CreateMessage("Hi, Man!", "admin", "John Doe"); text.Send(); }
public void btnCsv_click(object sender, DirectEventArgs e) { IList<object> lista = new List<object>(); IList<string> cabecera = ObtenerCabeceraExcel(); CrearExcel(ref lista, e, true); CreadorArchivos creador = new ConcreteCreator(); GeneradorArchivos archivo = creador.FactoryMethod(ConcreteCreator.TipoArchivo.CSV); archivo.CargarDatos(lista, cabecera, Response); }
private static void Main(string[] args) { Creator creator = new ConcreteCreator(); var product1 = creator.FactoryMethod(); var product2 = creator.FactoryMethod(); }
public void ClickOnEvent_btn_excelold(object sender, DirectEventArgs e) { IList<object> lista = new List<object>(); IList<string> cabecera = new List<string>(); cabecera.Add("Nombres"); cabecera.Add("Ape Paterno"); cabecera.Add("Ape Materno"); cabecera.Add("Rut"); cabecera.Add("Telefono"); cabecera.Add("Celular"); cabecera.Add("Email"); CrearExcel(ref lista, e, true); CreadorArchivos creador = new ConcreteCreator(); GeneradorArchivos archivo = creador.FactoryMethod(ConcreteCreator.TipoArchivo.XLS); archivo.CargarDatos(lista, cabecera, Response); }