static void Main(string[] args) { string str = @"Hello World!"; IStrategyInterface strategy = WriterFactory.CreateWriter("CONSOLE"); strategy.Write(str); }
public async Task TestOutput() { using (RedirectConsole console = new RedirectConsole()) { IStrategyInterface strategy = WriterFactory.CreateWriter("CONSOLE"); strategy.Write(@"Hello World!"); Assert.IsTrue(console.ToString().Contains("Hello World!")); } }
public static IStrategyInterface CreateWriter(string type) { IStrategyInterface strategy = (IStrategyInterface)objectFactory.GetTypeInstance(type); return(strategy != null ? strategy : new WriteToConsoleStrategy()); }