static void Main(string[] args) { // Creational AbstractFactoryExample.RunExample(); FactoryExample.RunExample(); SingletonExample.RunExample(); // Structural CompositeExample.RunExample(); FacadeExample.RunExample(); ProxyExample.RunExample(); // Behavioral AdapterExample.RunExample(); ChainOfResponseExample.RunExample(); IteratorExample.RunExample(); MediatorExample.RunExample(); ObserverExample.RunExample(); StrategyExample.RunExample(); var delegateAndEvents = new DelegateAndEventExample(); delegateAndEvents.RunDelegateExample(); delegateAndEvents.RunEventExample(); Console.ReadKey(true); }
static void Main(string[] args) { AdapterExample testAdapter = new AdapterExample(); testAdapter.TestAdapter(); Console.WriteLine("\n**********\n"); ChainOfResponsibilityExample testChainOfResponsibility = new ChainOfResponsibilityExample(); testChainOfResponsibility.TestChainOfResponsibility(); Console.WriteLine("\n**********\n"); Secretary testCommand = new Secretary(); testCommand.PrintDocument(); Console.WriteLine("\n**********\n"); FacadeExample testFacade = new FacadeExample(); testFacade.TestFacade(); Console.WriteLine("\n**********\n"); Furniture testAbstractFactory = new Furniture(); testAbstractFactory.TestFurniture(); Console.WriteLine("\n**********\n"); FactoryMethodExample testFactoryMethod = new FactoryMethodExample(); testFactoryMethod.TestFactoryMethod(); Console.WriteLine("\n**********\n"); OrderState OrderState = new OrderState(); OrderState.Register(); OrderState.Approve(); OrderState.Dispatch(); }
public void Run_RunsExample() { var facadeExample = new FacadeExample(this.goldMine); string outputString; using (var newOut = new StringWriter(CultureInfo.InvariantCulture)) { var previousOut = Console.Out; Console.SetOut(newOut); facadeExample.Run(CancellationToken.None); Console.SetOut(previousOut); outputString = newOut.ToString(); } Assert.That(outputString, Does.StartWith("Running facade example.")); Assert.That(outputString, Does.Contain("Operating gold mine.")); Assert.That(outputString, Does.Contain("Gold prospector finds a gold vein.")); }
public void Facade() { FacadeExample.Facade(); }