コード例 #1
0
 public void MessagePrinterFactory_CreateWindowsServicesMessagePrinter()
 {
     //arrange
     var HelloWorld = new MessagePrinterFactory();
     var controlled = new WindowsServicesMessagePrinter();
     //act
     var printer = HelloWorld.CreateMessagePrinter(MessageRecipientClientType.WINDOWS_SERVICES);
     //assert
     Assert.AreEqual(controlled, printer);
 }
コード例 #2
0
        public virtual IMessagePrinter CreateMessagePrinter(MessageRecipientClientType type)
        {
            IMessagePrinter printer = null;
            switch (type)
            {
                case MessageRecipientClientType.CONSOLE:
                    printer = new ConsoleMessagePrinter();
                    break;
                case MessageRecipientClientType.MOBILE:
                    printer = new MobileMessagePrinter();
                    break;
                case MessageRecipientClientType.WEB:
                    printer = new WebMessagePrinter();
                    break;
                case MessageRecipientClientType.WINDOWS_SERVICES:
                    printer = new WindowsServicesMessagePrinter();
                    break;
                default:
                    throw new NotImplementedException("The MessageRecipientClientType does not exist. Please Implement in API");
            }

            return printer;
        }
コード例 #3
0
 public void WindowsServicesMessagePrinter_NotImplemented()
 {
     var HelloWorld = new WindowsServicesMessagePrinter();
     HelloWorld.PrintMessage();
 }