Example #1
0
        static void Main(string[] args)
        {
            const string APPCFG_PUBLISHER_TYPE = "publisherType";
            const string APPCFG_WEBAPI_URI     = "webApiUri";
            const string APPCFG_WEBAPI_GETCMD  = "webApiGetHwCmd";

            string publisherType  = ConfigurationManager.AppSettings[APPCFG_PUBLISHER_TYPE];
            string webApiUri      = ConfigurationManager.AppSettings[APPCFG_WEBAPI_URI];
            string webApiGetHwCmd = ConfigurationManager.AppSettings[APPCFG_WEBAPI_GETCMD];



            IHwRepository apiRepo = new HwWebApiRepo(webApiUri, webApiGetHwCmd);



            IHwPublisher consolePub = HwPublisherFactory.CreateHwPublisher(publisherType);


            HelloWorldProcessor proc = new HelloWorldProcessor(apiRepo, consolePub);

            proc.PublishGreeting();

            Console.WriteLine("Press Enter to End Program.");
            Console.ReadLine();
        }
        public void PublisherTypeDBNotImplemented()
        {
            string publisherType = "database";

            IHwPublisher publisher = HwPublisherFactory.CreateHwPublisher(publisherType);

            Assert.IsInstanceOfType(publisher, typeof(HwConsolePublisher));
        }
        public void PublisherTypeConsole()
        {
            string publisherType = "console";

            IHwPublisher publisher = HwPublisherFactory.CreateHwPublisher(publisherType);

            Assert.IsInstanceOfType(publisher, typeof(HwConsolePublisher));
        }